# Templates for local and remote logging
$template DynLocalRsyslog, "/var/log/rsyslog/local/rsyslog/rsyslog.%syslogseverity-text%.log"
$template DynRemoteRsyslog, "/var/log/rsyslog/remote/%hostname:::secpath-replace%/rsyslog/rsyslog.%syslogseverity-text%.log"

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