我不确定我做错了什么,但我的 Linux 机器似乎没有将任何信息记录到消息文件中。有人能帮忙吗?
这是 /etc/rsyslog.conf 文件的内容(rsyslog-5.8.10-10.el6_6.x86_64)
# rsyslog v5 configuration file
# For more information see /usr/share/doc/rsyslog-*/rsyslog_conf.html
# If you experience problems, see http://www.rsyslog.com/doc/troubleshoot.html
#### MODULES ####
$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
$ModLoad imklog # provides kernel logging support (previously done by rklogd)
#$ModLoad immark # provides --MARK-- message capability
# Provides UDP syslog reception
#$ModLoad imudp
#$UDPServerRun 514
# Provides TCP syslog reception
#$ModLoad imtcp
#$InputTCPServerRun 514
#### GLOBAL DIRECTIVES ####
# Use default timestamp format
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
# File syncing capability is disabled by default. This feature is usually not required,
# not useful and an extreme performance hit
#$ActionFileEnableSync on
# Include all config files in /etc/rsyslog.d/
$IncludeConfig /etc/rsyslog.d/*.conf
#### RULES ####
# Log all kernel messages to the console.
# Logging much else clutters up the screen.
#kern.* /dev/console
kern.* /var/log/kernel
# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none;dhclient.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.* /var/log/boot.log
#local6.* /var/log/drupal.log
# ### begin forwarding rule ###
# The statement between the begin ... end define a SINGLE forwarding
# rule. They belong together, do NOT split them. If you create multiple
# forwarding rules, duplicate the whole block!
# Remote Logging (we use TCP for reliable delivery)
#
# An on-disk queue is created for this action. If the remote host is
# down, messages are spooled to disk and sent when it is up again.
#$WorkDirectory /var/lib/rsyslog # where to place spool files
#$ActionQueueFileName fwdRule1 # unique name prefix for spool files
#$ActionQueueMaxDiskSpace 1g # 1gb space limit (use as much as possible)
#$ActionQueueSaveOnShutdown on # save messages to disk on shutdown
#$ActionQueueType LinkedList # run asynchronously
#$ActionResumeRetryCount -1 # infinite retries if host is down
# remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional
#*.* @@remote-host:514
# ### end of the forwarding rule ###
以下是 ps 信息:
[root@ip-172-31-29-157 log]# ps ax | grep syslog
11821 ? Sl 0:00 /sbin/rsyslogd -i /var/run/syslogd.pid -c 5
12336 pts/0 S+ 0:00 grep syslog
[root@ip-172-31-29-157 log]#
一些系统信息:
[root@ip-172-31-29-157 log]# cat /proc/version
Linux version 2.6.32-642.el6.x86_64 ([email protected]) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) ) #1 SMP Tue May 10 17:27:01 UTC 2016
[root@ip-172-31-29-157 log]# cat /etc/redhat-release
CentOS release 6.8 (Final)
[root@ip-172-31-29-157 log]#
这是我的 /var/log/ 目录的内容
[root@ip-172-31-29-157 log]# ls
total 4.6M
4.0K drwxr-xr-x. 9 root root 4.0K Jun 1 14:31 .
4.0K drwxr-xr-x. 19 root root 4.0K Mar 24 2014 ..
4.0K drwxr-x---. 2 root root 4.0K May 11 02:17 audit
4.0K -rw-r--r--. 2 root root 1.5K Jun 1 00:11 boot.log
0 -rw-------. 1 root utmp 0 Jun 1 03:44 btmp
0 -rw-------. 1 root utmp 0 May 26 21:12 btmp-20160601
4.0K drwxr-xr-x. 2 root root 4.0K Jun 1 03:44 ConsoleKit
0 -rw-------. 1 root root 0 Jun 1 14:31 cron
1.8M -rw-------. 1 root root 1.8M Jun 1 14:01 cron-20160601
28K -rw-r--r--. 1 root root 25K Jun 1 00:11 dmesg
24K -rw-r--r--. 1 root root 23K May 23 01:32 dmesg.old
0 -rw-r--r--. 1 root root 0 May 27 03:44 dracut.log
2.4M -rw-r--r--. 1 root root 2.4M May 27 03:44 dracut.log-20160527
4.0K drwxr-x---. 2 exim exim 4.0K Jun 1 14:31 exim
4.0K drwx------. 2 root root 4.0K Jun 1 14:31 httpd
0 -rw-r--r--. 1 root root 0 Jun 1 14:31 kernel
4.0K -rw-r--r--. 1 root root 250 Jun 1 14:25 kernel-20160601
4.0K -rw-r--r--. 1 root root 64K Jun 1 14:18 lastlog
0 -rw-------. 1 root root 0 Jun 1 14:31 maillog
0 -rw-------. 1 root root 0 May 31 23:29 maillog-20160601
0 -rw-r--r--. 1 root root 0 Jun 1 14:31 messages
0 -rw-r--r--. 1 root root 0 Jun 1 14:23 messages-20160601
4.0K drwx------. 2 munge munge 4.0K Feb 20 2014 munge
4.0K drwxr-xr-x. 2 root root 4.0K Jun 1 03:44 newrelic
4.0K drwxr-xr-x. 2 ntp ntp 4.0K May 11 16:04 ntpstats
0 -rw-------. 1 root root 0 Jun 1 14:31 secure
68K -rw-------. 1 root root 61K Jun 1 14:18 secure-20160601
0 -rw-------. 1 root root 0 Jun 1 14:31 spooler
0 -rw-------. 1 root root 0 May 31 23:29 spooler-20160601
0 -rw-------. 1 root root 0 May 26 21:11 tallylog
0 -rw-rw-r--. 1 root utmp 0 Jun 1 14:31 wtmp
164K -rw-rw-r--. 1 root utmp 160K Jun 1 14:18 wtmp-20160601
0 -rw-------. 1 root root 0 Jun 1 14:31 yum.log
24K -rw-------. 1 root root 18K May 26 21:13 yum.log-20160601
[root@ip-172-31-29-157 log]#
PS:FWIW,内核也没有记录任何内容。是的,rsyslog 正在运行。