1 .\" Copyright (C) 1995 Andries Brouwer (aeb@cwi.nl)
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" Written 11 June 1995 by Andries Brouwer <aeb@cwi.nl>
24 .\" 2008-02-15, Jeremy Kerr <jk@ozlabs.org>
25 .\" Add info on command type 10; add details on types 6, 7, 8, & 9.
26 .\" 2008-02-15, Michael Kerrisk <mtk.manpages@gmail.com>
27 .\" Update LOG_BUF_LEN details; update RETURN VALUE section.
29 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
30 .\" all rights reserved.
31 .\" Translated Mon Dec 16 11:16:34 JST 2001
32 .\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
33 .\" Updated Thu Mar 6 2003 by Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
34 .\" Updated 2005-09-06, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
35 .\" Updated 2008-04-04, Akihiro MOTOKI, LDP v2.79
36 .\" Updated 2008-07-31, Akihiro MOTOKI, LDP v3.05
38 .\"WORD: kernel ¥«¡¼¥Í¥ë
39 .\"WORD: message ring buffer ¥á¥Ã¥»¡¼¥¸¡¦¥ê¥ó¥°¡¦¥Ð¥Ã¥Õ¥¡
40 .\"WORD: library ¥é¥¤¥Ö¥é¥ê
41 .\"WORD: kernel log buffer ¥«¡¼¥Í¥ë¡¦¥í¥°¡¦¥Ð¥Ã¥Õ¥¡
42 .\"WORD: console ¥³¥ó¥½¡¼¥ë
43 .\"WORD: kernel panic ¥«¡¼¥Í¥ë¡¦¥Ñ¥Ë¥Ã¥¯
44 .\"WORD: loglevel ¥í¥°¥ì¥Ù¥ë
45 .\"WORD: debug message ¥Ç¥Ð¥Ã¥°¡¦¥á¥Ã¥»¡¼¥¸
47 .TH SYSLOG 2 2008-06-20 "Linux" "Linux Programmer's Manual"
49 syslog, klogctl \- ¥«¡¼¥Í¥ë¤Î¥á¥Ã¥»¡¼¥¸¡¦¥ê¥ó¥°¡¦¥Ð¥Ã¥Õ¥¡¤òÆɤó¤À¤ê¾Ãµî¤·¤¿¤ê¤¹¤ë;
50 console_loglevel ¤ÎÀßÄê¤ò¹Ô¤¦
53 .BI "int syslog(int " type ", char *" bufp ", int " len );
54 .B " /* glibc ¤Ç¤Ï¥é¥Ã¥Ñ¡¼´Ø¿ô¤ÏÄ󶡤µ¤ì¤Æ¤¤¤Ê¤¤ */"
56 /* glibc ¤Î¥¤¥ó¥¿¥Õ¥§¡¼¥¹ */
58 .B "#include <sys/klog.h>"
60 .BI "int klogctl(int " type ", char *" bufp ", int " len );
64 ¤ÈÏä¹) C ¥é¥¤¥Ö¥é¥ê´Ø¿ô¤Î
69 ¤³¤Î̾Á°¤Î¥·¥¹¥Æ¥à¡¦¥³¡¼¥ë¤Ï¥«¡¼¥Í¥ë¤Î
71 ¥Ð¥Ã¥Õ¥¡¤òÀ©¸æ¤¹¤ë¤â¤Î¤Ç¤¢¤ê¡¢glibc ¤Ç¤Ï
75 \fItype\fP °ú¤¿ô¤Ï¤³¤Î´Ø¿ô¤ÎÆ°ºî¤ò·èÄꤹ¤ë¡£
81 * Commands to sys_syslog:
83 * 0 \-\- ¥í¥°¤òÊĤ¸¤ë¡£¸½ºß¤Î¼ÂÁõ¤Ç¤Ï²¿¤â¤·¤Ê¤¤ (NOP) ¡£
84 * 1 \-\- ¥í¥°¤ò³«¤¯¡£¸½ºß¤Î¼ÂÁõ¤Ç¤Ï²¿¤â¤·¤Ê¤¤ (NOP) ¡£
85 * 2 \-\- ¥í¥°¤«¤éÆɤ߽Ф¹¡£
86 * 3 \-\- ¥ê¥ó¥°¡¦¥Ð¥Ã¥Õ¥¡¤Ë»Ä¤Ã¤Æ¤¤¤ë¥á¥Ã¥»¡¼¥¸¤ò¤¹¤Ù¤ÆÆɤ߽Ф¹¡£
87 * 4 \-\- ¥ê¥ó¥°¡¦¥Ð¥Ã¥Õ¥¡¤Ë»Ä¤Ã¤Æ¤¤¤ë¥á¥Ã¥»¡¼¥¸¤ò¤¹¤Ù¤ÆÆɤ߽Ф·¡¢¾Ãµî¤¹¤ë¡£
88 * 5 \-\- ¥ê¥ó¥°¥Ð¥Ã¥Õ¥¡¤ò¾Ãµî¤¹¤ë¡£
89 * 6 \-\- ¥³¥ó¥½¡¼¥ë¤Ø¤Î printk ¤ò̵¸ú¤Ë¤¹¤ë¡£
90 * 7 \-\- ¥³¥ó¥½¡¼¥ë¤Ø¤Î printk ¤ò͸ú¤Ë¤¹¤ë¡£
91 * 8 \-\- ¥³¥ó¥½¡¼¥ë¤Ëɽ¼¨¤µ¤ì¤ë¥á¥Ã¥»¡¼¥¸¤Î¥ì¥Ù¥ë¤òÀßÄꤹ¤ë¡£
92 * 9 \-\- ¥í¥°¥Ð¥Ã¥Õ¥¡¤Î̤ÆɤÎʸ»ú¿ô¤òÊÖ¤¹¡£
93 * 10 \-\- ¥í¥°¥Ð¥Ã¥Õ¥¡¤Î¥µ¥¤¥º¤òÊÖ¤¹¡£
97 ÈóÆø¢¥×¥í¥»¥¹¤Ë¤Ï¥³¥Þ¥ó¥É 3 ¤È 10 ¤Î¤ß¤¬µö²Ä¤µ¤ì¤Æ¤¤¤ë
98 (¥³¥Þ¥ó¥É 9 ¤Ï Linux 2.4.10 ¤Ç¡¢¥³¥Þ¥ó¥É 10 ¤Ï Linux 2.6.6 ¤ÇÄɲ䵤줿)¡£
99 .SS ¥«¡¼¥Í¥ë¡¦¥í¥°¡¦¥Ð¥Ã¥Õ¥¡ (kernel log buffer)
102 ¤Î½ä²ó¼°¤Î¥Ð¥Ã¥Õ¥¡¤ò»ý¤Ã¤Æ¤ª¤ê¡¢
103 ¤½¤ì¤Ë¤Ï¥«¡¼¥Í¥ë´Ø¿ô¤Î
105 ¤Î°ú¤¿ô¤È¤·¤ÆÍ¿¤¨¤é¤ì¤¿
106 ¥á¥Ã¥»¡¼¥¸¤¬ (¤½¤Î¥í¥°¥ì¥Ù¥ë¤Ë¤«¤«¤ï¤é¤º) ³ÊǼ¤µ¤ì¤ë¡£
109 ¤ÎÃÍ¤Ï 4096 ¤Ç¤¢¤Ã¤¿¡£
110 ¥«¡¼¥Í¥ë 1.3.54 ¤«¤é¤Ï 8192¡¢
111 ¥«¡¼¥Í¥ë 2.1.113 ¤«¤é¤Ï 16384 ¤Ë¤Ê¤ê¡¢
112 ¥«¡¼¥Í¥ë 2.4.23 °Ê¹ß¤ª¤è¤Ó 2.6 °Ê¹ß¤Ç¤Ï¥«¡¼¥Í¥ë¤Î¥³¥ó¥Ñ¥¤¥ë»þ¤Ë
113 ÃͤòÀßÄê¤Ç¤¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡£
114 .\" Under "General setup" ==> "Kernel log buffer size"
115 .\" For 2.6, precisely the option seems to have appeared in 2.5.55.
116 ºÇ¶á¤Î¥«¡¼¥Í¥ë¤Ç¤Ï¡¢¥³¥Þ¥ó¥É 10 ¤Ç¥Ð¥Ã¥Õ¥¡¤Î¥µ¥¤¥º¤òÌ䤤¹ç¤ï¤»¤Ç¤¤ë¡£
118 .I "syslog(2,buf,len)"
119 ¤Î¸Æ¤Ó½Ð¤·¤Ï¥«¡¼¥Í¥ë¡¦¥í¥°¡¦¥Ð¥Ã¥Õ¥¡¤¬¶õ¤Ç¤Ê¤¯¤Ê¤ë¤Þ¤ÇÂԤäơ¢
120 ºÇÂç \fIlen\fP ¥Ð¥¤¥È¤Þ¤Ç \fIbuf\fP ¤Ø¤ÈÆɤ߽Ф·¡¢Æɤ߹þ¤ó¤À
121 ¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£¥í¥°¤«¤éÆɤޤ줿¥Ð¥¤¥È¤Ï¥í¥°¡¦¥Ð¥Ã¥Õ¥¡¤«¤é¾Ã¤¨¤ë:
122 ¾ðÊó¤Ï°ìÅÙ¤·¤«Æɤळ¤È¤¬¤Ç¤¤Ê¤¤¡£
123 ¤³¤ì¤Ï¥æ¡¼¥¶¡¼¤Î¥×¥í¥°¥é¥à¤¬
125 ¤òÆɤó¤À»þ¤Ë¥«¡¼¥Í¥ë¤Ë¤è¤Ã¤Æ¼Â¹Ô¤µ¤ì¤ë´Ø¿ô¤Ç¤â¤¢¤ë¡£
128 ¤Î¸Æ¤Ó½Ð¤·¤Ï¥í¥°¡¦¥Ð¥Ã¥Õ¥¡¤ÎºÇ¸å¤Î \fIlen\fP ¥Ð¥¤¥È¤ò
129 (ÈóÇ˲õŪ¤Ë)Æɤ߽Ф¹¡¢¤·¤«¤·¡¢Ä¾¶á¤Î¡Ö¥ê¥ó¥°¡¦¥Ð¥Ã¥Õ¥¡¾Ãµî¡×Ì¿Îá
130 (¤³¤ÎÌ¿Îá¤Ï¥Ð¥Ã¥Õ¥¡¤ò¾Ãµî¤¹¤ë¤ï¤±¤Ç¤Ï¤Ê¤¤)
131 °Ê¹ß¤Ë¥Ð¥Ã¥Õ¥¡¤Ë½ñ¤¹þ¤Þ¤ì¤¿¾ðÊó¤·¤«Æɤ߽Ф»¤Ê¤¤¡£
132 ÊÖ¤êÃͤÏÆɤ߹þ¤ó¤À¥Ð¥¤¥È¿ô¤Ç¤¢¤ë¡£
135 ¸Æ¤Ó½Ð¤·¤Ï¡Ö¥ê¥ó¥°¡¦¥Ð¥Ã¥Õ¥¡¾Ãµî¡×Ì¿Îá¤â¼Â¹Ô¤¹¤ë°Ê³°¤Ï
136 µ¡Ç½ 3 ¤È´°Á´¤ËƱ¤¸¤Ç¤¢¤ë¡£
138 .I syslog(5,dummy,dummy)
139 ¸Æ¤Ó½Ð¤·¤Ï¡Ö¥ê¥ó¥°¡¦¥Ð¥Ã¥Õ¥¡¾Ãµî¡×Ì¿Îá¤Î¤ß¤ò¼Â¹Ô¤¹¤ë
144 ¤¬ "dummy" ¤ÈµºÜ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢¤½¤Î°ú¤¿ô¤ÎÃͤ¬Ìµ»ë¤µ¤ì¤ë¤³¤È¤òɽ¤¹)¡£
146 .I syslog(6,dummy,dummy)
147 ¸Æ¤Ó½Ð¤·¤Ï¥³¥ó¥½¡¼¥ë¤Î¥í¥°¥ì¥Ù¥ë¤òºÇ¾®¤ËÀßÄꤷ¡¢
148 ¥³¥ó¥½¡¼¥ë¤Ë¥á¥Ã¥»¡¼¥¸¤¬É½¼¨¤µ¤ì¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¡£
150 .I syslog(7,dummy,dummy)
151 ¸Æ¤Ó½Ð¤·¤Ï¥³¥ó¥½¡¼¥ë¤Î¥í¥°¥ì¥Ù¥ë¤ò¥Ç¥Õ¥©¥ë¥È¤ËÀßÄꤷ¡¢
152 ¥³¥ó¥½¡¼¥ë¤Ë¥á¥Ã¥»¡¼¥¸¤¬É½¼¨¤µ¤ì¤ë¤è¤¦¤Ë¤¹¤ë¡£
154 .I syslog(8,dummy,level)
155 ¸Æ¤Ó½Ð¤·¤Ï¥³¥ó¥½¡¼¥ë¤Î¥í¥°¥ì¥Ù¥ë¤ò
159 ¤Ï 1 °Ê¾å 8 °Ê²¼¤ÎÀ°¿ô¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
161 .B ¥í¥°¥ì¥Ù¥ë (loglevel)
164 .I syslog(9,dummy,dummy)
165 ¸Æ¤Ó½Ð¤·¤Ï¥«¡¼¥Í¥ë¡¦¥í¥°¥Ð¥Ã¥Õ¥¡¤Ë¤¢¤ë¸½ºßÆɤ߽Ф·²Äǽ¤Ê¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£
167 .I syslog(10,dummy,dummy)
168 ¸Æ¤Ó½Ð¤·¤Ï¥«¡¼¥Í¥ë¡¦¥í¥°¥Ð¥Ã¥Õ¥¡¤ÎÁíÎ̤òÊÖ¤¹¡£
169 .SS ¥í¥°¥ì¥Ù¥ë (loglevel)
174 ÊÑ¿ô¤è¤ê¾®¤µ¤¤¤È¤¤Ë¤Î¤ß¡¢¥³¥ó¥½¡¼¥ë¤Ë¥á¥Ã¥»¡¼¥¸¤òɽ¼¨¤¹¤ë¡£
177 .B DEFAULT_CONSOLE_LOGLEVEL
178 (7) ¤ËÀßÄꤵ¤ì¤ë¤¬¡¢µ¯Æ°»þ¤Ë¥«¡¼¥Í¥ë¤Î
179 ¥³¥Þ¥ó¥É¡¦¥é¥¤¥ó¡¦¥ª¥×¥·¥ç¥ó¤Ë "debug" ¤È¤¤¤¦Ã±¸ì¤¬´Þ¤Þ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï
180 10 ¤ËÀßÄꤵ¤ì¡¢¥«¡¼¥Í¥ë¡¦¥Õ¥©¡¼¥ë¥È¤¬È¯À¸¤·¤¿¾ì¹ç¤Ë¤Ï 15 ¤ËÀßÄꤵ¤ì¤ë
181 (⤷¡¢10 ¤ä 15 ¤È¤¤¤¦¿ô»ú¤Ë°ÕÌ£¤Ï¤Ê¤¯¡¢8 ¤ÈƱÅù¤Ç¤¢¤ë)¡£
183 .IR syslog(8,dummy,value) .
184 ¸Æ¤Ó½Ð¤·¤Ë¤è¤Ã¤ÆÀßÄꤵ¤ì¡¢ÃͤÎÈÏ°Ï¤Ï 1-8 ¤Ç¤¢¤ë¡£
185 .I syslog(type,dummy,dummy)
186 ¸Æ¤Ó½Ð¤·¤Ç \fItype\fP ¤¬ 6 ¤â¤·¤¯¤Ï 7 ¤Î¾ì¹ç¡¢
187 console_loglevel ¤Ï 1 (¥«¡¼¥Í¥ë¡¦¥Ñ¥Ë¥Ã¥¯¤Î¤ß)¡¢
188 7 (¥Ç¥Ð¥Ã¥°¡¦¥á¥Ã¥»¡¼¥¸°Ê³°¤ÎÁ´¤Æ) ¤Ë¤½¤ì¤¾¤ìÀßÄꤵ¤ì¤ë¡£
190 ¥á¥Ã¥»¡¼¥¸¤Î³Æ¹Ô¤Ï¤½¤ì¤¾¤ì¤Ë¥í¥°¥ì¥Ù¥ë¤ò»ý¤Ä¡£¤³¤Î¥í¥°¥ì¥Ù¥ë¤Ï
191 .I "DEFAULT_MESSAGE_LOGLEVEL \- 1"
192 (6) ¤Ç¤¢¤ë¤¬¡¢ <d> (\fId\fP ¤Ï 1-7 ¤ÎÈϰϤοô»ú) ¤Ç»Ï¤Þ¤ë¹Ô¤Î
193 ¥í¥°¥ì¥Ù¥ë¤Ï \fId\fP ¤Ç¤¢¤ë¡£
194 ¥í¥°¥ì¥Ù¥ë¤Î´·½¬Åª¤Ê°ÕÌ£¤Ï
196 ¤Ë°Ê²¼¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë:
199 #define KERN_EMERG "<0>" /* ¥·¥¹¥Æ¥à¤¬»ÈÍÑÉÔǽ */
200 #define KERN_ALERT "<1>" /* ľ¤Á¤ËÂн褬ɬÍ× */
201 #define KERN_CRIT "<2>" /* Ã×̿Ū¤Ê¾õÂÖ */
202 #define KERN_ERR "<3>" /* ¥¨¥é¡¼¾õÂÖ */
203 #define KERN_WARNING "<4>" /* ·Ù¹ð¾õÂÖ */
204 #define KERN_NOTICE "<5>" /* Ä̾ï¾õÂÖ¤À¤¬Âç»ö¤Ê¾ðÊó */
205 #define KERN_INFO "<6>" /* ÄÌÃÎ */
206 #define KERN_DEBUG "<7>" /* ¥Ç¥Ð¥Ã¥°¥ì¥Ù¥ë¤Î¾ðÊó */
209 \fItype\fP ¤¬ 2, 3, 4 ¤Î¾ì¹ç¡¢À®¸ù¤¹¤ë¤È
211 ¤ÏÆɤ߽Ф·¤¿¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£
212 \fItype\fP ¤¬ 9 ¤Î¾ì¹ç¡¢
213 ¥«¡¼¥Í¥ë¡¦¥í¥°¥Ð¥Ã¥Õ¥¡¤Ë¤¢¤ë¸½ºßÆɤ߽Ф·²Äǽ¤Ê¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£
214 \fItype\fP ¤¬ 10 ¤Î¾ì¹ç¡¢
215 ¥«¡¼¥Í¥ë¡¦¥í¥°¥Ð¥Ã¥Õ¥¡¤ÎÁíÎ̤òÊÖ¤¹¡£
216 \fItype\fP ¤¬¤½¤ì°Ê³°¤ÎÃͤξì¹ç¡¢À®¸ù¤¹¤ë¤È 0 ¤¬ÊÖ¤µ¤ì¤ë¡£
218 ¥¨¥é¡¼¤Î¾ì¹ç¤Ï¡¢\-1\ ¤¬Ê֤ꡢ
219 \fIerrno\fP ¤Ë¥¨¥é¡¼¤ò¼¨¤¹Ãͤ¬ÀßÄꤵ¤ì¤ë¡£
226 ¤¬Àµ¤·¤¯¤Ê¤¤¡¢¤â¤·¤¯¤Ï
232 ¤¬ 0 ̤Ëþ¤Ç¤¢¤ë¡¢¤â¤·¤¯¤Ï
236 ¤¬ 1 °Ê¾å 8 °Ê²¼¤ÎÈϰϤËÆþ¤Ã¤Æ¤¤¤Ê¤¤)¡£
239 ½½Ê¬¤Ê¸¢¸Â¤ò»ý¤¿¤Ê¤¤¥×¥í¥»¥¹ (Àµ³Î¤Ë¤Ï
241 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò»ý¤¿¤Ê¤¤¥×¥í¥»¥¹) ¤¬ console_loglevel¤òÊѹ¹¤·¤è¤¦¤È¤·¤¿¤«¡¢
242 ¥«¡¼¥Í¥ë¡¦¥á¥Ã¥»¡¼¥¸¡¦¥ê¥ó¥°¤ò¾Ãµî¤·¤è¤¦¤È¤·¤¿¡£
245 ¥·¥¹¥Æ¥à¡¦¥³¡¼¥ë¤¬¥·¥°¥Ê¥ë¤Ë¤è¤Ã¤Æ³ä¤ê¹þ¤Þ¤ì¡¢²¿¤âÆɤ߽Ф»¤Ê¤«¤Ã¤¿¡£
246 (¥È¥ì¡¼¥¹Ãæ¤Ë¤·¤«È¯À¸¤¹¤ë¤³¤È¤Ï¤Ê¤¤)
249 ¥«¡¼¥Í¥ë¤ÎÀßÄꥪ¥×¥·¥ç¥ó
251 ¤ò̵¸ú¤Ë¤·¤Æ¥«¡¼¥Í¥ë¤¬¥³¥ó¥Ñ¥¤¥ë¤µ¤ì¤Æ¤¤¤ë¤¿¤á¡¢
253 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤¬ÍøÍѤǤ¤Ê¤¤¡£
255 ¤³¤Î¥·¥¹¥Æ¥à¡¦¥³¡¼¥ë¤Ï Linux ÆÃͤǤ¢¤ê¡¢°Ü¿¢¤ò°Õ¿Þ¤·¤¿¥×¥í¥°¥é¥à¤Ç¤Ï
258 ¤«¤Ê¤ê½é´ü¤Îº¢¤«¤é¡¢Æ±¤¸Ì¾Á°¤ò»ý¤Ä¥·¥¹¥Æ¥à¡¦¥³¡¼¥ë¤È
259 ¥é¥¤¥Ö¥é¥ê¡¦¥ë¡¼¥Á¥ó¤¬Á´¤¯°Û¤Ê¤ëÂåʪ¤Ç¤¢¤ë¤Î¤ÏÉÔ¹¬¤Ê¤³¤È¤À¤È
261 libc4 ¤È libc5 ¤Ç¤Ï¤³¤Î¥³¡¼¥ë¤ÎÈÖ¹æ¤Ï
264 glibc2.0 ¤Ç¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï
266 ¤È¤¤¤¦Ì¾Á°¤Ë²þ¤á¤é¤ì¤¿¡£