一、syslog日志服务:
1、守护进程:syslog 2、端口:514 3、配置文件:/etc/syslog.conf4、常见日志文件:
/var/log/dmesg 内核引导信息日志
/var/log/message 标准系统错误信息日志
/var/log/maillog 邮件系统信息日志
/var/log/cron 计划任务日志
/var/log/secure 安全信息日志
二、 配置文件:
syslog配置文件如下 -----------------------------------------------------------------[root@server ~]# vim /etc/syslog.conf# Log all kernel messages to the console.# Logging much else clutters up the screen.#kern.* /dev/console# Log anything (except mail) of level info or higher.# Don't log private authentication messages! *.info;mail.none;authpriv.none;cron.none /var/log/messages# The authpriv file has restricted access. authpriv.* /var/log/secure# Log all the mail messages in one place. mail.* -/var/log/maillog# Log cron stuff cron.* /var/log/cron# Everybody gets emergency messages *.emerg *# Save news errors of level crit and higher in a special file. uucp,news.crit /var/log/spooler# Save boot messages also to boot.log local7.* ----------------------------------------------------------------- |
[root@client ~]# vim /etc/sysconfig/syslog # 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 detailsSYSLOGD_OPTIONS="-r -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". ----------------------------------------------------------------- |
[root@client ~]# service syslog restart 关闭内核日志记录器: [确定] 关闭系统日志记录器: [确定] 启动系统日志记录器: [确定] 启动内核日志记录器: [确定] [root@client ~]# ----------------------------------------------------------------- |
[root@client ~]# vim /etc/syslog.conf # Log all kernel messages to the console. # Logging much else clutters up the screen. #kern.* /dev/console*.* @10.64.165.210 # The authpriv file has restricted access. authpriv.* /var/log/secure……下面省略----------------------------------------------------------------- |
[root@client ~]# cat /var/log/messages |tail Nov 30 16:44:29 10.64.165.200 kernel: klogd 1.4.1, log source = /proc/kmsg started. Nov 30 16:44:33 10.64.165.200 kernel: Removing netfilter NETLINK layer. Nov 30 16:44:33 10.64.165.200 kernel: ip_tables: (C) 2000-2006 Netfilter Core Team Nov 30 16:44:33 10.64.165.200 kernel: Netfilter messages via NETLINK v0.30. Nov 30 16:44:33 10.64.165.200 kernel: ip_conntrack version 2.4 (4096 buckets, 32768 max) - 228 bytes per conntrack ----------------------------------------------------------------- |
文章转载出处: