NLS log file forwarding
Posted: Wed Jun 10, 2020 3:36 pm
This is an RHEL 6.x system with rsyslog 5.8 so I can't use the new syntax to make life easier. I'm also a bit dumb when it comes to rsyslog config so, sorry...
I did try setting $programname but it failed...
A somewhat typical file forwarding config looks like this:
$InputFileName /var/log/ansible.log
$InputFileTag ansible.log
$InputFileStateFile state_var_log_ansible.log
$InputFileSeverity info
$InputFilePersistStateInterval 20000
$InputRunFileMonitor
if $programname == 'ansible.log' then @@[2001:4888:a00:3154:f0:ff2:0:b01]:5544
if $programname == 'ansible.log' then ~
Rsyslog allows wildcards in filenames so I don't see how I'd know programname if the config is something like what's below. I need something else to forward and stop the logging in the event wildcards are used. Any suggestions?
$InputFileName /var/log/mydir/*.log
$InputFileTag ansible.log
$InputFileStateFile state_var_log_mdydir_mylog
$InputFileSeverity info
$InputFilePersistStateInterval 20000
$InputRunFileMonitor
if $programname == '????.log' then @@[2001:4888:a00:3154:f0:ff2:0:b01]:5544
if $programname == '????.log' then ~
I did try setting $programname but it failed...
A somewhat typical file forwarding config looks like this:
$InputFileName /var/log/ansible.log
$InputFileTag ansible.log
$InputFileStateFile state_var_log_ansible.log
$InputFileSeverity info
$InputFilePersistStateInterval 20000
$InputRunFileMonitor
if $programname == 'ansible.log' then @@[2001:4888:a00:3154:f0:ff2:0:b01]:5544
if $programname == 'ansible.log' then ~
Rsyslog allows wildcards in filenames so I don't see how I'd know programname if the config is something like what's below. I need something else to forward and stop the logging in the event wildcards are used. Any suggestions?
$InputFileName /var/log/mydir/*.log
$InputFileTag ansible.log
$InputFileStateFile state_var_log_mdydir_mylog
$InputFileSeverity info
$InputFilePersistStateInterval 20000
$InputRunFileMonitor
if $programname == '????.log' then @@[2001:4888:a00:3154:f0:ff2:0:b01]:5544
if $programname == '????.log' then ~