rsyslog && 发送数据到其他主机

rsyslog && 发送数据到其他主机

使用中央操作系统6.4.

问题是 - 来自设施的消息kern.*不会出现在其他服务器上。

尝试发送数据:

# logger -p kern.warning -t TEST "Test warning for remote host KERNEL"
# logger -p cron.warning -t TEST "Test warning for remote host CRON"
# logger -p mail.warning -t TEST "Test warning for remote host MAIL"

检查MySQL数据:

mysql> select ID,Message from SystemEvents order by ID desc limit 3;
+--------+------------------------------------+
| ID     | Message                            |
+--------+------------------------------------+
| 524007 |  Test warning for remote host MAIL |
| 524006 |  Test warning for remote host CRON |
| 524005 |  Test warning for remote host MAIL |
+--------+------------------------------------+
3 rows in set (0.00 sec)

没有来自kern设施的数据。为什么?

主机接收者上的配置:

# cat /etc/rsyslog.conf | egrep -v '^[[:space:]]*$|#'
$ModLoad imudp
$UDPServerRun 514
$ModLoad imtcp
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
$IncludeConfig /etc/rsyslog.d/*.conf
kern.*                                                 /var/log/kern.log
syslog.*                                                /var/log/syslog.log
*.info;mail.none;authpriv.none;cron.none;local0.none                /var/log/messages
authpriv.*                                              /var/log/secure
mail.*                                                  -/var/log/maillog
cron.*                                                  /var/log/cron
*.emerg                                                 *
uucp,news.crit                                          /var/log/spooler
local7.*                                                /var/log/boot.log

MySQL收件人配置:

# cat /etc/rsyslog.d/hostname.conf
$ModLoad ommysql
:fromhost, isequal, "hostname" :ommysql:localhost,Syslog,rsyslog,megapass

和主机发送者:

# cat /etc/rsyslog.conf | egrep -v '^[[:space:]]*$|#'
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
$IncludeConfig /etc/rsyslog.d/*.conf
kern.*                                                  @hostname
syslog.*                                                /var/log/syslog.log
*.info;mail.none;authpriv.none;cron.none                /var/log/messages
authpriv.*                                              /var/log/secure
mail.*                                                  -/var/log/maillog
mail.*                                                  @hostname
cron.*                                                  /var/log/cron
cron.*                                                  @hostname
*.emerg                                                 *
uucp,news.crit                                          /var/log/spooler
local7.*                                                /var/log/boot.log
local4.*                                                /var/log/ldap.log

UPD

另外,我注意到数据甚至没有发送到本地文件:

kern.*                                                  /var/log/kern.log

和:

# logger -p kern.warning -t TEST "Test warning for local host KERNEL"

和:

# tail /var/log/kern.log | grep "TEST"

什么都不返回。

那么,如果我猜测logger“无法从内核”发送数据,我猜对了吗?这听起来合乎逻辑……

答案1

来自记录器手册页上的设施名称:

kern       cannot be generated from user process

来源在这里:http://man7.org/linux/man-pages/man1/logger.1.html

相关内容