[rsyslog-notify] Forum Thread: using dynamic filename to log - (Mode 'post')

noreply at adiscon.com noreply at adiscon.com
Sat Mar 1 10:08:13 CET 2014


User: dhaivat.desai 
Forumlink: http://kb.monitorware.com/viewtopic.php?p=24281#p24281

Message: 
----------
Hello,
I have floowing configuration for rsyslog:

================================

template(name="test_template" type="list") {
property(name="msg")
constant(value="\n")
}

# imtcp
module(load="imtcp" MaxSessions="500")
input(type="imtcp" port="9095")

# omfile
module(load="builtin:omfile")

:app-name, isequal, "test_app"
*.* action(type="omfile"
DirCreateMode="0700"
FileCreateMode="0666"
File="/opt/space/test_app.log"
Template="test_template")

================================

I am sending messages in rfc5424 format(with app-name=test_app).
It works fine and my log messages are logged in /opt/space/test_app.log

Is it possible to use dynamic filename instead of static
filename(File="/opt/space/test_app.log") in above case..?
i.e.I want to use property_replacer/global-variable to generate a filename
to log.

One of the possibilities is to use something similar to following:
$template DynFile,"/var/log/system-%HOSTNAME%.log"

but it looks like $template is now obsolated in newer versions of rsyslog.

guidance..?

Best Regards,
Dhaivat Desai.


More information about the rsyslog-notify mailing list