0
votes

I would like my rsyslog to print exact logs to two different files. One is /var/log/messages this is done by default RHEL rule:

*.info;mail.none;authpriv.none;cron.none                /var/log/messages

And the second is a $hostname_messages.log stored on shared mountpoint between two nodes of a Veritas Cluster Storage cluster. This is done by:

$template PerCMDNode,"/foo/bar/system/%HOSTNAME%_messages.log"
*.info;mail.none;authpriv.none;cron.none                -?PerCMDNode

All is working fine untill i stop the cluster service and shared mount point become unavailable for rsyslog. In such situation rsyslog exits upon signal 15 and stops logging not only to that shared log file (which is pretty obvious) but to all log files.

My question is if I could make rsyslog ignore missing log file and carry on logging when the file comes back online?

1

1 Answers

0
votes

You may be able to simply redirect when the shared logfile is "suspended" http://www.rsyslog.com/action-execonlywhenpreviousissuspended-preciseness/

$template PerCMDNode,"/foo/bar/system/%HOSTNAME%_messages.log" *.info;mail.none;authpriv.none;cron.none -?PerCMDNode $ActionExecOnlyWhenPreviousIsSuspended on & /var/log/localbuffer # Might also ask rsyslog to discard here. $ActionExecOnlyWhenPreviousIsSuspended off