全部博文(55)
分类: LINUX
2011-03-21 17:07:37
==========================================================================================================
监控文件/path/to/dir/mylog.log并将消息发送至syslogcenter:10514
------------------------------------------------------------------------------------------------
local1.* @syslogcenter:10514
*.info;mail.none;authpriv.none;cron.none;local1.none; /var/log/messages
#$ModLoad imfile
#nginx error.log local1
#$InputFileName /path/to/dir/mylog.log
#$InputFileTag flogs:
#$InputFileStateFile filetag001
#$InputFileSeverity error
#$InputFileFacility local1
#$InputRunFileMonitor
#$InputFilePollingInterval 1
==========================================================================================================
接收监听消息后处理
------------------------------------------------------------------------------------------------
$DirOwner test
$DirGroup test
$DirCreateMode 0755
$FileGroup test
$FileOwner test
$umask 0022
$ModLoad template
$template myLogs,"/var/log/mylogs/%fromhost-ip%/%$YEAR%/%$MONTH%/%$DAY%/mylog.txt"
$template myFormat,"%msg%\n"
*.info;mail.none;authpriv.none;cron.none;local1.none; /var/log/messages
if $syslogtag contains 'flogs' then -?myLogs;myFormat
==========================================================================================================
参考:
rsyslog.conf configuration file:
Modules:
Text File Input Module:
Filter Conditions:
Actions:
Templates:
Configuration Directives:
The Property Replacer:
Config Snippets:
==========================================================================================================