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 ?
1 Answer
$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.