.\" Written Feb 1994 by Steve Greenland (stevegr@neosoft.com) .\" .\" 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. .\" .\" Updated 1999.12.19 by Karl M. Hegbloom .\" .\" Updated 13 Oct 2001, Michael Kerrisk .\" Added description of vsyslog .\" Added descriptions of LOG_ODELAY and LOG_NOWAIT .\" Added brief description of facility and option arguments .\" Added CONFORMING TO section .\" 2001-10-13, aeb, minor changes .\" Modified 13 Dec 2001, Martin Schulze .\" Modified 3 Jan 2002, Michael Kerrisk .\" .\" Japanese Verion Copyright (c) 1996 Shoichi OZAWA .\" all right reserved. .\" Translated Sep 1 20:14:01 JST 1996 .\" by Shoichi OZAWA .\" Updated Thu Oct 18 01:00:02 JST 2001 .\" by Akihiro MOTOKI .\" Updated Fri Jan 4 22:15:21 JST 2002 .\" by Akihiro MOTOKI .\" Updated 2002-04-14 by Kentaro Shirakata .\" Updated 2007-01-01 by Kentaro Shirakata .\" .TH SYSLOG 3 2008-11-12 "Linux" "Linux Programmer's Manual" .\"O .SH NAME .\"O closelog, openlog, syslog, vsyslog \- send messages to the system logger .SH 名前 closelog, openlog, syslog, vsyslog \- システムロガーにメッセージを送る .\"O .SH SYNOPSIS .SH 書式 .B #include .sp .BI "void openlog(const char *" ident ", int " option ", int " facility ); .br .BI "void syslog(int " priority ", const char *" format ", ...);" .br .B "void closelog(void);" .sp .B #include .sp .BI "void vsyslog(int " priority ", const char *" format ", va_list " ap ); .sp .in -4n .\"O Feature Test Macro Requirements for glibc (see .\"O .BR feature_test_macros (7)): glibc 向けの機能検査マクロの要件 .RB ( feature_test_macros (7) 参照): .in .sp .BR vsyslog (): _BSD_SOURCE .\"O .SH DESCRIPTION .SH 説明 .\"O .BR closelog () .\"O closes the descriptor being used to write to the system logger. .\"O The use of .\"O .BR closelog () .\"O is optional. .BR closelog () はシステムのログ記録用プログラム(システムロガー .BR syslogd (8)) ヘの接続を終了する。 .BR closelog () は必須ではない。 .sp .\"O .BR openlog () .\"O opens a connection to the system logger for a program. .BR openlog () はログを出力しようとしているプログラムからログ記録用プログラムへの 接続を開始する。 .\"O The string pointed .\"O to by .\"O .I ident .\"O is prepended to every message, and is typically set to the program name. .I ident で指定した文字列(通常は .BR openlog () したプログラムの名前)はログ出力の一文一文に追加され、どのプログラム が出力したログかを識別するために使われる。 .\"O The .\"O .I option .\"O argument specifies flags which control the operation of .\"O .BR openlog () .\"O and subsequent calls to .\"O .BR syslog (). .I option 引き数は、 .BR openlog () の動作とその後の .BR syslog () の呼び出しを制御するフラグを指定する。 .\"O The .\"O .I facility .\"O argument establishes a default to be used if .\"O none is specified in subsequent calls to .\"O .BR syslog (). .I facility 引き数は、後で .BR syslog () を呼び出す際に facility が指定されなかった場合に使用される デフォルト値を決定する。 .\"O Values for .\"O .I option .\"O and .\"O .I facility .\"O are given below. .\"O The use of .\"O .BR openlog () .\"O is optional; it will automatically be called by .\"O .BR syslog () .\"O if necessary, in which case .\"O .I ident .\"O will default to NULL. .I option と .I facility については後述する。 .BR openlog () は必須ではなく、必要に応じて .BR syslog () から呼び出される。 .BR syslog () が呼び出した場合、 .I ident のデフォルト値は NULL になる。 .sp .\"O .BR syslog () .\"O generates a log message, which will be distributed by .\"O .BR syslogd (8). .BR syslog () はログメッセージを出力し、 .BR syslogd (8) がそのメッセージを記録する。 .\"O The .\"O .I priority .\"O argument is formed by ORing the .\"O .I facility .\"O and the .\"O .I level .\"O values (explained below). .I priority 引き数は .I facility と .I level との組合せで指定する。 .I facility と .I level の取りうる値は後述する。 .\"O The remaining arguments .\"O are a .\"O .IR format , .\"O as in .\"O .BR printf (3) .\"O and any arguments required by the .\"O .IR format , .\"O except that the two character sequence .\"O .B %m .\"O will be replaced by .\"O the error message string .\"O .IR strerror ( errno ). .\"O A trailing newline may be added if needed. 残りの .I format 引き数は .BR printf (3) と似たスタイルの書式とその書式に与える値である。 .I format 中の2文字 .B %m はその時点での .I errno に関連するエラーメッセージ文字列 .RI ( strerror ) によって置き換えられる。 必要な場合は末尾に改行が加えられる。 .\"O The function .\"O .BR vsyslog () .\"O performs the same task as .\"O .BR syslog () .\"O with the difference that it takes a set of arguments which have .\"O been obtained using the .\"O .BR stdarg (3) .\"O variable argument list macros. .BR vsyslog () 関数は .BR syslog () と同じ機能を持つが、可変引き数リストを指定することができる点が異なる。 指定された引き数は、 .BR stdarg (3) 可変引き数リストマクロを用いて取得される。 .\"O The subsections below list the parameters used to set the values of .\"O .IR option , " facility" ", and " priority . .\"O .SS option .\"O The .\"O .I option .\"O argument to .\"O .BR openlog () .\"O is an OR of any of these: 以下のサブセクションでは、 .I option と .I facility と .I priority の値を設定するのに使用されるパラメータを説明する。 .SS option 下記の値を OR したものが .BR openlog () の .I option 引き数になる: .TP 15 .B LOG_CONS .\"O Write directly to system console if there is an error while sending to .\"O system logger. エラーがあれば、システムロガーに送る一方でシステムコンソールにも直接書く。 .TP .B LOG_NDELAY .\"O Open the connection immediately (normally, the connection is opened when .\"O the first message is logged). ログ記録用プログラムとの接続を即座に開始する (通常は、最初のメッセージが記録される時に接続を開く)。 .TP .B LOG_NOWAIT .\"O Don't wait for child processes that may have been created while logging .\"O the message. .\"O (The GNU C library does not create a child process, so this .\"O option has no effect on Linux.) メッセージを記録する際に生成される子プロセスの終了を待たない。 (GNU C ライブラリは子プロセスを生成しない。 したがって、このオプションは Linux では無効である。) .TP .B LOG_ODELAY .\"O The converse of .\"O .BR LOG_NDELAY ; .\"O opening of the connection is delayed until .\"O .BR syslog () .\"O is called. .\"O (This is the default, and need not be specified.) .B LOG_NDELAY の反対。 .BR syslog () が呼ばれるまで、接続の開始を行わない。 (このオプションはデフォルトであり、特に指定する必要はない。) .TP .B LOG_PERROR .\"O (Not in POSIX.1-2001.) .\"O Print to stderr as well. stderr にも出力する。(POSIX.1-2001 では定義されていない) .TP .B LOG_PID .\"O Include PID with each message. 個々のメッセージに PID を含める。 .\"O .SS facility .SS facility .\"O The .\"O .I facility .\"O argument is used to specify what type of program is logging the message. .\"O This lets the configuration file specify that messages from different .\"O facilities will be handled differently. .I facility 引き数はメッセージに記録されるプログラムのタイプを指定するために使われる。 これによって異なるタイプのプログラムからのメッセージは異なる扱いを するように設定ファイル( .BR syslog.conf (5)) に定義できる。 .TP 15 .B LOG_AUTH .\"O security/authorization messages (DEPRECATED Use .\"O .B LOG_AUTHPRIV .\"O instead) セキュリティ/認証 メッセージ (非推奨。代わりに .B LOG_AUTHPRIV を使用すること) .TP .B LOG_AUTHPRIV .\"O security/authorization messages (private) セキュリティ/認証 メッセージ (プライベート) .TP .B LOG_CRON .\"O clock daemon .\"O .RB ( cron " and " at ) クロックデーモン .RB ( cron と .RB at ) .TP .B LOG_DAEMON .\"O system daemons without separate facility value 特定の facility 値を持たないシステムデーモン .TP .B LOG_FTP .\"O ftp daemon ftp デーモン .TP .B LOG_KERN .\"O kernel messages (these can't be generated from user processes) カーネルメッセージ (ユーザプロセスから生成することはできない) .\" LOG_KERN has the value 0; if used as a facility, zero translates to: .\" "use the default facility". .TP .\"O .BR LOG_LOCAL0 " through " LOG_LOCAL7 .\"O reserved for local use .BR LOG_LOCAL0 " から " LOG_LOCAL7 ローカルな使用のためにリザーブされている .TP .B LOG_LPR .\"O line printer subsystem ラインプリンタ・サブシステム .TP .B LOG_MAIL .\"O mail subsystem メール・サブシステム .TP .B LOG_NEWS .\"O USENET news subsystem USENET ニュース・サブシステム .TP .B LOG_SYSLOG .\"O messages generated internally by .\"O .BR syslogd (8) .BR syslogd (8) によって内部的に発行されるメッセージ .TP .\"O .BR LOG_USER " (default)" .BR LOG_USER " (デフォルト)" .\"O generic user-level messages 一般的なユーザレベルメッセージ .TP .B LOG_UUCP .\"O UUCP subsystem UUCPサブシステム .SS level .\"O This determines the importance of the message. .\"O The levels are, in order of decreasing importance: これはメッセージの優先度を指定する。 優先度の高いものから低いものの順で下記する。 .TP 15 .B LOG_EMERG .\"O system is unusable システムが使用不可 .TP .B LOG_ALERT .\"O action must be taken immediately 直ちに行動を起こさなければならない .TP .B LOG_CRIT .\"O critical conditions 危険な状態 .TP .B LOG_ERR .\"O error conditions エラーの状態 .TP .B LOG_WARNING .\"O warning conditions ワーニングの状態 .TP .B LOG_NOTICE .\"O normal, but significant, condition 通常だが重要な状態 .TP .B LOG_INFO .\"O informational message インフォメーションメッセージ .TP .B LOG_DEBUG .\"O debug-level message デバッグレベルのメッセージ .LP .\"O The function .\"O .BR setlogmask (3) .\"O can be used to restrict logging to specified levels only. .BR setlogmask (3) 関数を使用して、 指定されたレベルのメッセージだけを記録するように 制限することができる。 .\"O .SH "CONFORMING TO" .SH 準拠 .\"O The functions .\"O .BR openlog (), .\"O .BR closelog (), .\"O and .\"O .BR syslog () .\"O (but not .\"O .BR vsyslog ()) .\"O are specified in SUSv2 and POSIX.1-2001. .BR openlog (), .BR closelog (), .BR syslog () は SUSv2 と POSIX.1-2001 で規定されている (但し .BR vsyslog () は除く)。 .\"O POSIX.1-2001 specifies only the .\"O .B LOG_USER .\"O and .\"O .B LOG_LOCAL* .\"O values for .\"O .IR facility . POSIX.1-2001 では .I facility として .B LOG_USER と .B LOG_LOCAL* の値が規定されているだけである。 .\"O However, with the exception of .\"O .B LOG_AUTHPRIV .\"O and .\"O .BR LOG_FTP , .\"O the other .\"O .I facility .\"O values appear on most UNIX systems. しかしながら、 .B LOG_AUTHPRIV と .B LOG_FTP という例外はあるが、 それ以外の .I facility の値は多くの UNIX システムで使われている。 .\"O The .\"O .B LOG_PERROR .\"O value for .\"O .I option .\"O is not specified by POSIX.1-2001, but is available .\"O in most versions of UNIX. .I option の値の .B LOG_PERROR の値は、 POSIX.1-2001 では規定されていないが、 UNIX の多くのバージョンで使用可能である。 .\"O .\" .SH HISTORY .\" .SH 履歴 .\"O .\" A .\"O .\" .BR syslog () .\"O .\" function call appeared in 4.2BSD. .\" .BR syslog () .\" ファンクション・コールは 4.2BSD から実装された。 .\"O .\" 4.3BSD documents .\"O .\" .BR openlog (), .\"O .\" .BR syslog (), .\"O .\" .BR closelog (), .\"O .\" and .\"O .\" .BR setlogmask (). .\" 4.3BSD には .\" .BR openlog (), .\" .BR syslog (), .\" .BR closelog (), .\" .BR setlogmask () .\" が実装されている。 .\"O .\" 4.3BSD-Reno also documents .\"O .\" .BR vsyslog (). .\" また、4.3BSD-Reno には .\" .BR vsyslog () .\" が実装されている。 .\"O .\" Of course early v* functions used the .\"O .\" .I .\"O .\" mechanism, which is not compatible with .\"O .\" .IR . .\" 当然ながら初期の v* 関数は .\" .I .\" とは互換性のない .\" .I .\" の仕組を使用したものである。 .\"O .SH NOTES .SH 注意 .\"O The argument .\"O .I ident .\"O in the call of .\"O .BR openlog () .\"O is probably stored as-is. .BR openlog () 呼び出しの .I ident 引き数は、値がそのまま保持されていることを前提にしている。 .\"O Thus, if the string it points to .\"O is changed, .\"O .BR syslog () .\"O may start prepending the changed string, and if the string .\"O it points to ceases to exist, the results are undefined. それゆえ、 .I ident で指定された文字列が変更されると、 .BR syslog () は変更された文字列の追加するだろうし、 指定された文字列が存在しなくなった場合、結果は未定義である。 .\"O Most portable is to use a string constant. 最も移植性がある方法は、文字列定数を使用することである。 .LP .\"O Never pass a string with user-supplied data as a format, .\"O use the following instead: ユーザーから与えられたデータを format として渡してはならない。 代わりに以下を使うこと。 .nf syslog(priority, "%s", string); .fi .\"O .SH "SEE ALSO" .SH 関連項目 .BR logger (1), .BR setlogmask (3), .BR syslog.conf (5), .BR syslogd (8)