Syslog is the general standard (IETF) for logging system and program messages in the Linux environment.
This service constitutes the system log daemon, where any program can do its logging (debug, security, normal operation) through in addition the Linux kernel messages.
--该服务由其daemon进程/sbin/syslogd维护,可通过如下命令启动
1 service syslog start
2 /etc/init.d/syslog start
--配置文件为/etc/sysconfig/syslog,大致结构如下;其中klogd负责捕获kernel日志信息
# Options to syslogd
# -m 0 disables 'MARK' messages.
# -r enables logging from remote machines
# -x disables DNS lookups on messages recieved with -r
# See syslogd(8) for more details
SYSLOGD_OPTIONS="-m 0"
# Options to klogd
# -2 prints all kernel oops messages twice; once for klogd to decode, and
# once for processing with 'ksymoops'
# -x disables all klogd processing of oops messages entirely
# See klogd(8) for more details
KLOGD_OPTIONS="-x"
#
SYSLOG_UMASK=077
# set this to a umask value to use for all log files as in umask(1).
# By default, all permissions are removed for "group" and "other".
In principle, the logs handled by syslog are available in the /var/log/ directory on Linux system:
# ls /var/log
acpid cron.1 maillog.3 rpmpkgs.3 spooler.3
anaconda.log cron.2 maillog.4 rpmpkgs.4 spooler.4
anaconda.syslog cron.3 messages sa squid
anaconda.xlog cron.4 messages.1 samba tallylog
audit cups messages.2 scrollkeeper.log vbox
boot.log dmesg messages.3 secure wtmp
boot.log.1 faillog messages.4 secure.1 Xorg.0.log
boot.log.2 gdm oracle-validated secure.2 Xorg.0.log.old
boot.log.3 httpd pm secure.3 YaST2
boot.log.4 lastlog ppp secure.4 yum.log
btmp mail prelink setroubleshoot
conman maillog rpmpkgs spooler
conman.old maillog.1 rpmpkgs.1 spooler.1
cron maillog.2 rpmpkgs.2 spooler.2
where some of the logs are dumped under a subdirectory like cups, samba, httpd. Among the logs under /var/log the /var/log/messages is the most common one as the kernel / core system logs are held there. The kernel modules generally dumps there too. So, for problem diagnosis / monitoring the /var/log/messages is the primary log file to examine.
--syslog产生的日志位于/var/log目录下,其中messages是最常用到的,记录startup信息等
The logs are rotated every week (renaming the existing log to filename.number order):
# ls -l /var/log/messages*
-rw------- 1 root root 1973 Jun 10 15:07 /var/log/messages
-rw------- 1 root root 10866 Jun 6 04:02 /var/log/messages.1
-rw------- 1 root root 19931 May 30 04:02 /var/log/messages.2
-rw------- 1 root root 238772 May 23 04:02 /var/log/messages.3
-rw------- 1 root root 171450 May 14 18:29 /var/log/messages.4
Rsyslogd可以看作是syslogd的改良版,可通过man 8 rsyslogd查看详细信息。
以下是最常见的/var/log日志介绍
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/27203330/viewspace-737138/ ,如需转载,请注明出处,否则将追究法律责任。