Using rsyslog to create different log files for different processes

Posted by user80203 on Server Fault See other posts from Server Fault or by user80203
Published on 2011-07-08T02:32:55Z Indexed on 2012/09/06 15:40 UTC
Read the original article Hit count: 220

Filed under:
|
|

Scenario: I am running a cluster of machines. Each machine runs various python programs with a unique (across the cluster), but dynamically set, ID.

Right now, they are all logging locally. So, I might have logs that look like:

process_5.log
process_6.log

for processes that had ID's 5 and 6.

Another machine may have:

process_20.log
process_25.log

I wish to forward these logs to a logserver running rsyslogd. Python's logging facility has a nice syslog handler, so I understand how I could connect to the remote server. What I haven't figured out is how to use templating/DynFile to maintain log separation.

e.g. on the logserver, I will want to see:

process_5.log
process_6.log
process_20.log
process_25.log

which correspond to the logs of the same name on the sending machine.

Is there a way to pull this off with rsyslogd templating?

© Server Fault or respective owner

Related posts about logging

Related posts about syslog