Hi list,

mabe I should have asked here first but I tried IRC, Server Fault and
StackOverflow already. I would appreciate if you could help me with this:

I post the text from my question on SO here in case you prefer to keep it
on the list (
http://stackoverflow.com/questions/22692681/how-can-i-log-messages-to-generic-changing-files)

---------------------------------------

This question is similar to the unanswered rsyslog specific question on
Server Fault (
http://serverfault.com/questions/512240/rsyslog-filtering-based-on-message-content).
It is not clear to me if the best solution is via already existing
software like rsyslog or logstash or if I have to build something myself.
This is why I ask here.

Problem
=======
I have several python processes (**not** handled by multiprocessing) that
run in parallel. They build groups which need to write to the same logfile
of that group. Logging from multiple processes to the same file has to go
through some kind of serialization to avoid file corruption, so rsyslog or
logstash come to mind.
What I did not manage to find out (neither for rsyslog nor for logstash) is
how to filter for a field (or tag or whatever it might be called in that
system) that contains a file name I can't know beforehand (contains version
numbers I don't control) and write these messages to the correspondent file.
So, I know how it's done for static input filters with dynamic output. But
I don't know how it's done for dynamic input and dynamic output.

My favorite fantasy solution
============================
In the Python applications:
- Create a custom formatter which adds a field (e.g. syslogtag for rsyslog)
containing the name of the target log file
- Add a SyslogHandler or something similar to my logger.
In rsyslog or logstash config add a rule like
    <config of some logging system>
    [filterfor] <field> -> write messages containing <value of field> to
logfile /path/to/logs/<value of field>.log

done.

Question
========
Is this possible out of the box or (in logstash) with a (yet to be written)
plugin?

-------------------------------------

Thanks for your help
Oliver
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of 
sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE 
THAT.

Reply via email to