busybox syslogd & klogd
上面這張圖可以完整解釋 syslog 的原理。
用法:
openlog ("MyProgram", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL0);
syslog (LOG_INFO, "Program started by User %d", getuid ());
syslog (LOG_ERR, "Ouch an ERROR!");
closelog ();
openlog & closelog 可以不需要
而 klogd 則是抓取 kernel 並送給 syslog 存起來,可以從下面看出來。
static void doKlogd(...)
{
...
syslog(priority, "%s", message);
...
}
reference:
http://fanqiang.chinaunix.net/a4/b8/20010524/190000219_b.html
http://www.codealias.info/technotes/syslog_simple_example
http://www.linuxselfhelp.com/gnu/glibc/html_chapter/libc_18.html
http://www.cyut.edu.tw/~ywfan/netlab/20060912chapter11-log.htm
http://moto.debian.tw/viewtopic.php?t=9059&
http://www.softpanorama.org/Logs/syslog.shtml
留言
張貼留言