how to forward specific log file to a remote rsyslog server -
i have cassandra node (192.168.122.3) , rsyslog server(192.168.122.2). on cassandra node, cassandra dumps log files in /var/log/cassandra/cassandra.log. want pull cassandra.log file remote server(rsyslog server) in /var/log/ directory. how ?
$modload imfile #load imfile input module
$inputfilepollinterval 10 $inputfilename /var/log/cassandra/cassandra.log
$inputfiletag cassandra-access:
$inputfilestatefile stat-cassandra-access
$inputfileseverity info
$inputrunfilemonitor
$template cas_log, " %msg% "
if $programname == 'cassandra-access' @@remote_server_address:port;cas_log
if $programname == 'cassandra-access' stop
follow following steps:
1) go /etc/rsyslog.d
2) create empty file named cas-log.conf
3) copy above mentioned code , paste this(cas-log) file. note: replace destination rsyslog server ip/name in second last line remote_server_address & port.
4) restart rsyslog.
5) on sever side can see logs in /var/log/syslog file.
Comments
Post a Comment