OSDN Git Service

(split) DP: release pages (catch up to 3.50).
[linuxjm/LDP_man-pages.git] / release / man3 / syslog.3
1 .\" Written  Feb 1994 by Steve Greenland (stevegr@neosoft.com)
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\" Updated 1999.12.19 by Karl M. Hegbloom <karlheg@debian.org>
26 .\"
27 .\" Updated 13 Oct 2001, Michael Kerrisk <mtk.manpages@gmail.com>
28 .\"     Added description of vsyslog
29 .\"     Added descriptions of LOG_ODELAY and LOG_NOWAIT
30 .\"     Added brief description of facility and option arguments
31 .\"     Added CONFORMING TO section
32 .\" 2001-10-13, aeb, minor changes
33 .\" Modified 13 Dec 2001, Martin Schulze <joey@infodrom.org>
34 .\" Modified 3 Jan 2002, Michael Kerrisk <mtk.manpages@gmail.com>
35 .\"
36 .\"*******************************************************************
37 .\"
38 .\" This file was generated with po4a. Translate the source file.
39 .\"
40 .\"*******************************************************************
41 .TH SYSLOG 3 2012\-08\-17 Linux "Linux Programmer's Manual"
42 .SH 名前
43 closelog, openlog, syslog, vsyslog \- システムロガーにメッセージを送る
44 .SH 書式
45 \fB#include <syslog.h>\fP
46 .sp
47 \fBvoid openlog(const char *\fP\fIident\fP\fB, int \fP\fIoption\fP\fB, int
48 \fP\fIfacility\fP\fB);\fP
49 .br
50 \fBvoid syslog(int \fP\fIpriority\fP\fB, const char *\fP\fIformat\fP\fB, ...);\fP
51 .br
52 \fBvoid closelog(void);\fP
53 .sp
54 \fB#include <stdarg.h>\fP
55 .sp
56 \fBvoid vsyslog(int \fP\fIpriority\fP\fB, const char *\fP\fIformat\fP\fB, va_list
57 \fP\fIap\fP\fB);\fP
58 .sp
59 .in -4n
60 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
61 .in
62 .sp
63 \fBvsyslog\fP(): _BSD_SOURCE
64 .SH 説明
65 \fBcloselog\fP()  はシステムのログ記録用プログラム(システムロガー \fBsyslogd\fP(8))  ヘの接続を終了する。
66 \fBcloselog\fP()  は必須ではない。
67 .sp
68 \fBopenlog\fP() はログを出力しようとしているプログラムからログ記録用
69 プログラム (system logger) への 接続を開始する。
70 \fIident\fP で指定した文字列は各メッセージの前に付与される。
71 通常は \fIident\fP にはプログラム名が設定される。
72 \fIident\fP が NULL の場合、プログラムが \fIident\fP として使用される
73 (POSIX.1\-2008 では \fIident\fP が NULL の場合の動作は規定されていない)。
74
75 \fIoption\fP 引き数は、 \fBopenlog\fP() の動作とその後の \fBsyslog\fP() の呼び
76 出しを制御するフラグを指定する。 \fIfacility\fP 引き数は、後で \fBsyslog\fP()
77 を呼び出す際に facility が指定されなかった場合に使用される デフォルト値
78 を決定する。 \fIoption\fP と \fIfacility\fP については後述する。
79 \fBopenlog\fP() は必須ではなく、必要に応じて \fBsyslog\fP() から呼び出される。
80 \fBsyslog\fP() が呼び出した場合、 \fIident\fP のデフォルト値は NULL になる。
81 .sp
82 \fBsyslog\fP()  はログメッセージを出力し、 \fBsyslogd\fP(8)  がそのメッセージを記録する。 \fIpriority\fP 引き数は
83 \fIfacility\fP と \fIlevel\fP との組合せで指定する。 \fIfacility\fP と \fIlevel\fP の取りうる値は後述する。 残りの
84 \fIformat\fP 引き数は \fBprintf\fP(3)  と似たスタイルの書式とその書式に与える値である。 \fIformat\fP 中の2文字 \fB%m\fP
85 はその時点での \fIerrno\fP に関連するエラーメッセージ文字列 (\fIstrerror\fP)  によって置き換えられる。
86 必要な場合は末尾に改行が加えられる。
87
88 \fBvsyslog\fP()  関数は \fBsyslog\fP()  と同じ機能を持つが、可変引き数リストを指定することができる点が異なる。
89 指定された引き数は、 \fBstdarg\fP(3)  可変引き数リストマクロを用いて取得される。
90
91 以下のサブセクションでは、 \fIoption\fP と \fIfacility\fP と \fIpriority\fP
92 の値を設定するのに使用されるパラメータを説明する。
93 .SS option
94 下記の値を OR したものが \fBopenlog\fP()  の \fIoption\fP 引き数になる:
95 .TP  15
96 \fBLOG_CONS\fP
97 エラーがあれば、システムロガーに送る一方でシステムコンソールにも直接書く。
98 .TP 
99 \fBLOG_NDELAY\fP
100 ログ記録用プログラムとの接続を即座に開始する (通常は、最初のメッセージが記録される時に接続を開く)。
101 .TP 
102 \fBLOG_NOWAIT\fP
103 メッセージを記録する際に生成される子プロセスの終了を待たない。 (GNU C ライブラリは子プロセスを生成しない。 したがって、このオプションは
104 Linux では無効である。)
105 .TP 
106 \fBLOG_ODELAY\fP
107 \fBLOG_NDELAY\fP の反対。 \fBsyslog\fP()  が呼ばれるまで、接続の開始を行わない。
108 (このオプションはデフォルトであり、特に指定する必要はない。)
109 .TP 
110 \fBLOG_PERROR\fP
111 stderr にも出力する。
112 (POSIX.1\-2001 と POSIX.1\-2008 では定義されていない)
113 .TP 
114 \fBLOG_PID\fP
115 個々のメッセージに PID を含める。
116 .SS facility
117 \fIfacility\fP 引き数はメッセージに記録されるプログラムのタイプを指定するために使われる。
118 これによって異なるタイプのプログラムからのメッセージは異なる扱いを するように設定ファイル( \fBsyslog.conf\fP(5))  に定義できる。
119 .TP  15
120 \fBLOG_AUTH\fP
121 security/authorization messages
122 .TP 
123 \fBLOG_AUTHPRIV\fP
124 セキュリティ/認証 メッセージ (プライベート)
125 .TP 
126 \fBLOG_CRON\fP
127 クロックデーモン (\fBcron\fP と at\fB)\fP
128 .TP 
129 \fBLOG_DAEMON\fP
130 特定の facility 値を持たないシステムデーモン
131 .TP 
132 \fBLOG_FTP\fP
133 ftp デーモン
134 .TP 
135 \fBLOG_KERN\fP
136 .\" LOG_KERN has the value 0; if used as a facility, zero translates to:
137 .\" "use the default facility".
138 カーネルメッセージ (ユーザプロセスから生成することはできない)
139 .TP 
140 \fBLOG_LOCAL0\fP から \fBLOG_LOCAL7\fP
141 ローカルな使用のためにリザーブされている
142 .TP 
143 \fBLOG_LPR\fP
144 ラインプリンタ・サブシステム
145 .TP 
146 \fBLOG_MAIL\fP
147 メール・サブシステム
148 .TP 
149 \fBLOG_NEWS\fP
150 USENET ニュース・サブシステム
151 .TP 
152 \fBLOG_SYSLOG\fP
153 \fBsyslogd\fP(8)  によって内部的に発行されるメッセージ
154 .TP 
155 \fBLOG_USER\fP (デフォルト)
156 一般的なユーザレベルメッセージ
157 .TP 
158 \fBLOG_UUCP\fP
159 UUCPサブシステム
160 .SS level
161 これはメッセージの優先度を指定する。 優先度の高いものから低いものの順で下記する。
162 .TP  15
163 \fBLOG_EMERG\fP
164 システムが使用不可
165 .TP 
166 \fBLOG_ALERT\fP
167 直ちに行動を起こさなければならない
168 .TP 
169 \fBLOG_CRIT\fP
170 危険な状態
171 .TP 
172 \fBLOG_ERR\fP
173 エラーの状態
174 .TP 
175 \fBLOG_WARNING\fP
176 ワーニングの状態
177 .TP 
178 \fBLOG_NOTICE\fP
179 通常だが重要な状態
180 .TP 
181 \fBLOG_INFO\fP
182 インフォメーションメッセージ
183 .TP 
184 \fBLOG_DEBUG\fP
185 デバッグレベルのメッセージ
186 .LP
187 \fBsetlogmask\fP(3)  関数を使用して、 指定されたレベルのメッセージだけを記録するように 制限することができる。
188 .SH 準拠
189 .\" .SH HISTORY
190 .\" A
191 .\" .BR syslog ()
192 .\" function call appeared in 4.2BSD.
193 .\" 4.3BSD documents
194 .\" .BR openlog (),
195 .\" .BR syslog (),
196 .\" .BR closelog (),
197 .\" and
198 .\" .BR setlogmask ().
199 .\" 4.3BSD-Reno also documents
200 .\" .BR vsyslog ().
201 .\" Of course early v* functions used the
202 .\" .I <varargs.h>
203 .\" mechanism, which is not compatible with
204 .\" .IR <stdarg.h> .
205 \fBopenlog\fP(), \fBcloselog\fP(), \fBsyslog\fP() は SUSv2, POSIX.1\-2001,
206 POSIX.1\-2008 で規定されている (但し \fBvsyslog\fP() は除く)。
207 POSIX.1\-2001 では \fIfacility\fP として \fBLOG_USER\fP と \fBLOG_LOCAL*\fP の値
208 が規定されているだけである。 しかしながら、 \fBLOG_AUTHPRIV\fP と
209 \fBLOG_FTP\fP という例外はあるが、 それ以外の \fIfacility\fP の値は多くの
210 UNIX システムで使われている。 \fIoption\fP の値の \fBLOG_PERROR\fP の値は、
211 POSIX.1\-2001 と POSIX.1\-2008 では規定されていないが、
212 UNIX の多くのバージョンで使用可能である。
213 .SH 注意
214 \fBopenlog\fP()  呼び出しの \fIident\fP 引き数は、値がそのまま保持されていることを前提にしている。 それゆえ、 \fIident\fP
215 で指定された文字列が変更されると、 \fBsyslog\fP()  は変更された文字列の追加するだろうし、
216 指定された文字列が存在しなくなった場合、結果は未定義である。 最も移植性がある方法は、文字列定数を使用することである。
217 .LP
218 ユーザーから与えられたデータを format として渡してはならない。 代わりに以下を使うこと。
219 .nf
220
221     syslog(priority, "%s", string);
222 .fi
223 .SH 関連項目
224 \fBlogger\fP(1), \fBsetlogmask\fP(3), \fBsyslog.conf\fP(5), \fBsyslogd\fP(8)
225 .SH この文書について
226 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.50 の一部
227 である。プロジェクトの説明とバグ報告に関する情報は
228 http://www.kernel.org/doc/man\-pages/ に書かれている。