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

%if %%getVar('activer_reception_logs', 'non') == 'non'
# all messages go in local branch
:syslogtag, startswith, "/usr/sbin/gpm" ?DynLocalGpm
& stop
%else
# all messages from localhost go in local branch
if $syslogtag startswith '/usr/sbin/gpm' and $fromhost-ip startswith '127' then ?DynLocalGpm
& stop
%if %%mode_conteneur_actif == 'oui'
# all messages from containers go in local branch
if $syslogtag startswith '/usr/sbin/gpm' and $fromhost-ip startswith '%%adresse_ip_br0[:-2]' then ?DynLocalGpm
& stop
if $syslogtag startswith '/usr/sbin/gpm' and $fromhost startswith '%%adresse_ip_br0[:-2]' then ?DynLocalGpm
& stop
%end if
# all remaining messages go in remote branch
:syslogtag, startswith, "/usr/sbin/gpm" ?DynRemoteGpm
& stop
%end if

