Linux system logs
Server commissioning and maintenance require a professional log system. Linux provides a daemon (SYSLOGD) to handle the system log, and now it is using its upgraded version (RSYSLOGD) on the Linux system.
The RSYSLOGD daemon can receive both the log of the user's process output and the kernel log.
The user process generates the system log by invoking the Syslog function. The function outputs the log to a UNIX local domain socket type (af_unix) file/dev/log, Rsyslogd listens to the file to get the output of the user process.
The kernel log is printed into the ring buffer of the kernel by functions such as PRINTK. The contents of the ring cache are mapped directly to the/proc/kmsg file. RSYSLOGD gets the kernel log by reading the file.
After the RSYSLOGD daemon receives a log of the user process or kernel input, it outputs them to some specific log files. By default, the debug information is saved to the/var/log/debug file, the normal information is saved to the/var/log/messages file, and the kernel information is saved to the/var/log/kern.log file. The details of how the log information is distributed can be set in the RSYSLOGD configuration file (/etc/rsyslog.conf).
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/42/C2/wKioL1PYwTqiW6_WAACFFTzoM9E430.jpg "title=" Qq20140730175100.png "alt=" Wkiol1pywtqiw6_waacfftzom9e430.jpg "/>
syslog function
The application uses a syslog function to communicate with the RSYSLOGD daemon.
#include <syslog.h>
void syslog (int priority, const char* message, ...);