0

I have the following statement in my /etc/rsyslog.conf:

# This one is the template to generate the log filename dynamically
$template DynFile,"/var/log/proxy/%$year%/%$month%/%$now%.log"

if $fromhost-ip == '192.168.1.1' then *.* ?DynFile

The idea is to split a local and remote logs into separate dirs and files.

rsyslog daemon starts without any errors but expected logs are not created. If I replace "if" statement with simple *.* ?DynFile then logs are populated, but of course then they aren't splitted.

XorOrNor
  • 8,868
  • 12
  • 48
  • 81

1 Answers1

0

In your case, i think it's just a syntax error :

$template DynFile,"/var/log/proxy/%$year%/%$month%/%$now%.log"
if $fromhost-ip == '127.0.0.1' then ?DynFile

** I use "127.0.0.1" for localhost

Pwu
  • 58
  • 7