Arup Barua February 2016

how to forward specific log file to a remote rsyslog server

I have a cassandra node (192.168.122.3) and a rsyslog server(192.168.122.2). On cassandra node, cassandra dumps its log files in /var/log/cassandra/cassandra.log. I want to pull this cassandra.log file to the remote server(rsyslog server) in the /var/log/ directory. how to do it ?

Answers


meera February 2016

$ModLoad imfile    #Load the 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' then @@remote_server_address:port;cas_log
if $programname == 'cassandra-access' then stop

Follow the following steps:
1) Go to /etc/rsyslog.d
2) create a empty file named as cas-log.conf
3) Copy the above mentioned code and paste into this(cas-log) file. Note: replace the destination rsyslog server ip/name in second last line with remote_server_address & port.
4) Restart your rsyslog.
5) On sever side you can see logs in /var/log/syslog file.

Post Status

Asked in February 2016
Viewed 2,769 times
Voted 5
Answered 1 times

Search




Leave an answer