标签:rsyslog
rsyslog默认只可以传送系统的日志,比如DHCP,cron等,现在要传送一个服务的日志到远端的rsyslog服务器,该怎么实现呢?
解决方法:要使用rsyslog的imfile模块。
参考官方url:http://www.rsyslog.com/doc/v8-stable/configuration/modules/imfile.html
参考网上url:http://www.tuicool.com/articles/Jv2eUvn
rsyslog的配置文件(过滤掉了注释的内容):
[root@pf ~]# cat /etc/rsyslog.conf | egrep -v "#|^$"
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
$IncludeConfig /etc/rsyslog.d/*.conf
*.info;mail.none;authpriv.none;cron.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
$ModLoad imfile
$InputFileName /usr/local/pf/logs/packetfence.log
$InputFileTag packetfence:
$InputFileSeverity info
$InputFileStateFile stat-packetfence
$InputFileFacility local5
$InputFilePollInterval 1
$InputFilePersistStateInterval 1
$InputRunFileMonitor
local5.* @10.64.41.223:514
[root@pf ~]#
修改完配置文件,重启服务
[root@pf ~]# /etc/init.d/rsyslog restart
Shutting down system logger: [ OK ]
Starting system logger: [ OK ]
[root@pf ~]#
红色字体是为了传送/usr/local/pf/logs/packetfence.log到10.64.41.223:514而新加的配置。
标签:rsyslog
原文地址:http://tenderrain.blog.51cto.com/9202912/1701462