hi again,
long time no see

i've seen that some other users are having issues with filtering...
filter-questions-t9876.html is related to my original question, so it's good to have one answer in one place...
:fromhost-ip, isequal, "192.168.0.4" /var/log/router/systems.log
& ~
:fromhost-ip, isequal, "192.168.0.5" /var/log/switch/systems.log
& ~
is fine if you are happy with one big file but I need to have dynamic logfiles... so I approached it in two ways, none of which work :-/
note: /etc/rsyslog.conf has the following directives:
--
.
.
.
$IncludeConfig /etc/rsyslog.d/*.conf
$ResetConfigVariables
.
.
.
$template DynaFile,"/var/log/%HOSTNAME%.%$DAY%%$MONTH%%$YEAR%.log"
*.* -?DynaFile
[EOF]
--
approach 1:
---
/etc/rsyslog.d/networks.conf$template NetworksFile,"/var/log/networks/%HOSTNAME%.%$DAY%%$MONTH%%$YEAR%.log"
if $source == '1.2.3.4' and ( ($syslogseverity-text == 'info') o
r ($syslogseverity-text == 'notice') ) and ( $syslogfacility-text
!= 'mail' and $syslogfacility-text != 'authpriv' and
$syslogfacility-text != 'cron' ) then ?NetworksFile
if $source == '1.2.3.5' and ( ($syslogseverity-text == 'info') o
r ($syslogseverity-text == 'notice') ) and ( $syslogfacility-text
!= 'mail' and $syslogfacility-text != 'authpriv' and
$syslogfacility-text != 'cron' ) then ?NetworksFile
---
...it yields same results if $fromhost-ip is used instead...
approach 2:
---
/etc/rsyslog.d/servers.conf$template Servers,/var/log/servers/%HOSTNAME%.%$DAY%%$MONTH%%$YEAR%.log
:fromhost-ip, isequal, "1.3.5.7" *.* ?Servers
& ~
:fromhost-ip, isequal, "1.3.5.9" *.* ?Servers
& ~
:fromhost-ip, isequal, "1.3.5.11" *.* ?Servers
& ~
---
Once rsyslog is reloaded the target directories are empty and everything ends up under /var/log ... which is not desired.
Are my approaches correct? is the syntax valid?? rsyslog comes up cleanly but I like to ask anyway... the "-?TemplateName" or "?TemplateName" part confuses me a bit...
Thanks!