1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268
|
.\" Copyright (C) 1995 Andries Brouwer (aeb@cwi.nl)
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" Written 11 June 1995 by Andries Brouwer <aeb@cwi.nl>
.\" 2008-02-15, Jeremy Kerr <jk@ozlabs.org>
.\" Add info on command type 10; add details on types 6, 7, 8, & 9.
.\" 2008-02-15, Michael Kerrisk <mtk.manpages@gmail.com>
.\" Update LOG_BUF_LEN details; update RETURN VALUE section.
.\"
.\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
.\" all rights reserved.
.\" Translated Mon Dec 16 11:16:34 JST 2001
.\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\" Updated Thu Mar 6 2003 by Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
.\" Updated 2005-09-06, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
.\" Updated 2008-04-04, Akihiro MOTOKI, LDP v2.79
.\" Updated 2008-07-31, Akihiro MOTOKI, LDP v3.05
.\"
.\"WORD: kernel ͥ
.\"WORD: message ring buffer åХåե
.\"WORD: library 饤֥
.\"WORD: kernel log buffer ͥ롦Хåե
.\"WORD: console
.\"WORD: kernel panic ͥ롦ѥ˥å
.\"WORD: loglevel ٥
.\"WORD: debug message ǥХåå
.\"
.TH SYSLOG 2 2008-06-20 "Linux" "Linux Programmer's Manual"
.SH ̾
syslog, klogctl \- ͥΥåХåեɤõꤹ;
console_loglevel Ԥ
.SH
.nf
.BI "int syslog(int " type ", char *" bufp ", int " len );
.B " /* glibc ǤϥåѡؿƤʤ */"
.sp
/* glibc Υե */
.br
.B "#include <sys/klog.h>"
.sp
.BI "int klogctl(int " type ", char *" bufp ", int " len );
.fi
.SH
.RB ( syslogd (8)
ä) C 饤֥ؿ
.BR syslog ()
ɬפʾϡ
.BR syslog (3)
뤳ȡ
̾Υƥࡦϥͥ
.IR printk ()
Хåե椹ΤǤꡢglibc Ǥ
.BR klogctl ()
ȸƤФƤ롣
\fItype\fP Ϥδؿưꤹ롣
.I kernel/printk.c
ΰ :
.nf
/*
* Commands to sys_syslog:
*
* 0 \-\- Ĥ롣ߤμǤϲ⤷ʤ (NOP)
* 1 \-\- ߤμǤϲ⤷ʤ (NOP)
* 2 \-\- ɤ߽Ф
* 3 \-\- Хåե˻ĤäƤå٤ɤ߽Ф
* 4 \-\- Хåե˻ĤäƤå٤ɤ߽Фõ롣
* 5 \-\- Хåեõ롣
* 6 \-\- ؤ printk ̵ˤ롣
* 7 \-\- ؤ printk ͭˤ롣
* 8 \-\- ɽåΥ٥ꤹ롣
* 9 \-\- Хåե̤ɤʸ֤
* 10 \-\- ХåեΥ֤
*/
.fi
øץˤϥޥ 3 10 ΤߤĤƤ
(ޥ 9 Linux 2.4.10 ǡޥ 10 Linux 2.6.6 ɲä줿)
.SS ͥ롦Хåե (kernel log buffer)
ͥĹ
.B LOG_BUF_LEN
νΥХåեäƤꡢ
ˤϥͥؿ
.BR printk ()
ΰȤͿ줿
å (Υ٥ˤ餺) Ǽ롣
ΥͥǤ
.B LOG_BUF_LEN
ͤ 4096 Ǥä
ͥ 1.3.54 8192
ͥ 2.1.113 16384 ˤʤꡢ
ͥ 2.4.23 ʹߤ 2.6 ʹߤǤϥͥΥѥ
ͤǤ褦ˤʤäƤ롣
.\" Under "General setup" ==> "Kernel log buffer size"
.\" For 2.6, precisely the option seems to have appeared in 2.5.55.
ǶΥͥǤϡޥ 10 ǥХåեΥ䤤碌Ǥ롣
.I "syslog(2,buf,len)"
θƤӽФϥͥ롦ХåեǤʤʤޤԤäơ
\fIlen\fP ХȤޤ \fIbuf\fP ؤɤ߽Фɤ߹
Хȿ֤ɤޤ줿ХȤϥХåեä:
ϰ٤ɤळȤǤʤ
ϥ桼Υץब
.I /proc/kmsg
ɤ˥ͥˤäƼ¹ԤؿǤ⤢롣
.I syslog(3,buf,len)
θƤӽФϥХåեκǸ \fIlen\fP ХȤ
(˲Ū)ɤ߽ФľΡ֥Хåեõ̿
(̿ϥХåեõ櫓ǤϤʤ)
ʹߤ˥Хåե˽ޤ줿ɤ߽Фʤ
֤ͤɤ߹ХȿǤ롣
.I syslog(4,buf,len)
ƤӽФϡ֥Хåեõ̿¹Ԥʳ
ǽ 3 ȴƱǤ롣
.I syslog(5,dummy,dummy)
ƤӽФϡ֥Хåեõ̿Τߤ¹Ԥ
(ƤӽФνǡ
.I buf
.I len
"dummy" ȵܤƤ硢ΰ̵ͤ뤵뤳Ȥɽ)
.I syslog(6,dummy,dummy)
ƤӽФϥΥ٥Ǿꤷ
˥åɽʤ褦ˤ롣
.I syslog(7,dummy,dummy)
ƤӽФϥΥ٥ǥեȤꤷ
˥åɽ褦ˤ롣
.I syslog(8,dummy,level)
ƤӽФϥΥ٥
.I level
ꤹ롣
.I level
1 ʾ 8 ʲǤʤФʤʤ
ܺ٤
.B ٥ (loglevel)
ȤΤȡ
.I syslog(9,dummy,dummy)
ƤӽФϥͥ롦Хåեˤ븽ɤ߽ФǽʥХȿ֤
.I syslog(10,dummy,dummy)
ƤӽФϥͥ롦Хåե̤֤
.SS ٥ (loglevel)
ͥ롦롼
.BR printk ()
ϡ٥뤬
.I console_loglevel
ѿ꾮ȤˤΤߡ˥åɽ롣
.I console_loglevel
Ϻǽ
.B DEFAULT_CONSOLE_LOGLEVEL
(7) ꤵ뤬ư˥ͥ
ޥɡ饤ץ "debug" Ȥñ줬ޤޤƤ
10 ꤵ졢ͥ롦եȤȯˤ 15 ꤵ
(â10 15 Ȥ˰̣Ϥʤ8 ƱǤ)
ѿ
.IR syslog(8,dummy,value) .
ƤӽФˤäꤵ졢ͤϰϤ 1-8 Ǥ롣
.I syslog(type,dummy,dummy)
ƤӽФ \fItype\fP 6 ⤷ 7 ξ硢
console_loglevel 1 (ͥ롦ѥ˥åΤ)
7 (ǥХååʳ) ˤ줾ꤵ롣
åγƹԤϤ줾˥٥ġΥ٥
.I "DEFAULT_MESSAGE_LOGLEVEL \- 1"
(6) Ǥ뤬 <d> (\fId\fP 1-7 ϰϤο) ǻϤޤԤ
٥ \fId\fP Ǥ롣
٥δŪʰ̣
.I <linux/kernel.h>
˰ʲΤ褦Ƥ:
.nf
#define KERN_EMERG "<0>" /* ƥबǽ */
#define KERN_ALERT "<1>" /* ľн褬ɬ */
#define KERN_CRIT "<2>" /* ̿Ūʾ */
#define KERN_ERR "<3>" /* 顼 */
#define KERN_WARNING "<4>" /* ٹ */
#define KERN_NOTICE "<5>" /* ֤̾ʾ */
#define KERN_INFO "<6>" /* */
#define KERN_DEBUG "<7>" /* ǥХå٥ξ */
.fi
.SH ֤
\fItype\fP 2, 3, 4 ξ硢
.BR syslog ()
ɤ߽ФХȿ֤
\fItype\fP 9 ξ硢
ͥ롦Хåեˤ븽ɤ߽ФǽʥХȿ֤
\fItype\fP 10 ξ硢
ͥ롦Хåե̤֤
\fItype\fP ʳͤξ硢 0 ֤롣
顼ξϡ\-1\ ֤ꡢ
\fIerrno\fP ˥顼ͤꤵ롣
.SH 顼
.TP
.B EINVAL
ʰ
(Ūˤϡ
.I type
ʤ⤷
.I type
2, 3, 4 ξ
.I buf
NULL
.I len
0 ̤Ǥ롢⤷
.I type
8 ξ
.I level
1 ʾ 8 ʲϰϤäƤʤ)
.TP
.B EPERM
ʬʸ¤ʤץ (Τˤ
.B CAP_SYS_ADMIN
ѥӥƥʤץ) console_loglevelѹ褦Ȥ
ͥ롦åõ褦Ȥ
.TP
.B ERESTARTSYS
ƥࡦ뤬ʥˤäƳޤ졢ɤ߽Фʤä
(ȥ졼ˤȯ뤳ȤϤʤ)
.TP
.B ENOSYS
ͥꥪץ
.BR CONFIG_PRINTK
̵ˤƥͥ뤬ѥ뤵Ƥ뤿ᡢ
.BR syslog ()
ƥॳ뤬ѤǤʤ
.SH
Υƥࡦ Linux ͭǤꡢܿտޤץǤ
ѤƤϤʤ
.SH
ʤκ顢Ʊ̾ĥƥࡦ
饤֥ꡦ롼ۤʤʪǤΤԹʤȤ
դƤ
libc4 libc5 ǤϤΥֹ
.B SYS_klog
Ƥ
glibc2.0 ǤΥƥॳ
.BR klogctl ()
Ȥ̾˲줿
.SH Ϣ
.BR syslog (3)
|