# Templates for local and remote logging
$template DynLocalGuardian, "/var/log/rsyslog/local/e2guardian/%programname%.%syslogseverity-text%.log"
$template DynRemoteGuardian, "/var/log/rsyslog/remote/%fromhost%/e2guardian/%programname%.%syslogseverity-text%.log"

%if %%activer_log_distant == 'oui' and %%activer_reception_logs == 'non'
# all messages go in local branch
:programname, startswith, "e2guardian" ?DynLocalGuardian
& stop
%else
# all messages from localhost go in local branch
if $programname startswith 'e2guardian' and $fromhost-ip startswith '127' then ?DynLocalGuardian
& stop
%if %%mode_conteneur_actif == 'oui'
# all messages from containers go in local branch
if $programname startswith 'e2guardian' and $fromhost-ip startswith '%%adresse_ip_br0[:-2]' then ?DynLocalGuardian
& stop
if $programname startswith 'e2guardian' and $fromhost startswith '%%adresse_ip_br0[:-2]' then ?DynLocalGuardian
& stop
%end if
# all remaining messages go in remote branch
:programname, startswith, "e2guardian" ?DynRemoteGuardian
& stop
%end if
