I'm using rsyslog 8.22 to receive syslog data sent from client hosts. My goal is to have one log file created per client.
I've found a lot of data on older versions of rsyslog, but the change in configuration syntax has thrown me.
This configuration proves rsyslog is working, but aggregates all entries into one file:
if $fromhost-ip startswith '192.168.117.' then {
action(type="omfile" file="/var/log/network.log")
stop
}
(The rest of my /etc/rsyslog.conf
is default.)
The following is not working. (No file is created):
template (name="DynFile" type="string" string="/var/log/network-%fromhost-ip%.log")
if $fromhost-ip startswith '192.168.117.' then {
action(type="omfile" file="DynFile")
stop
}
What am I missing?
The fix is to specify
dynaFile
in the action argument (notfile
).This creates the expected results: