# Templates for local and remote logging
$template DynLocalZephir, "/var/log/rsyslog/local/zephir/zephir.log"
$template DynRemoteZephir, "/var/log/rsyslog/remote/%hostname:::secpath-replace%/zephir/zephir.log"
%if %%getVar('activer_reception_logs', 'non') == 'non'
# all messages go in local branch
:programname, isequal, "zephir" ?DynLocalZephir
& stop
%else
# all messages from localhost go in local branch
if $programname == 'zephir' and $fromhost-ip startswith '127' then ?DynLocalZephir
& stop
 %if %%mode_conteneur_actif == 'oui'
# all messages from containers go in local branch
if $programname == 'zephir' and $fromhost-ip startswith '%%adresse_ip_br0[:-2]' then ?DynLocalZephir
& stop
if $programname == 'zephir' and $fromhost startswith '%%adresse_ip_br0[:-2]' then ?DynLocalZephir
& stop
 %end if
# all remaining messages go in remote branch
:programname, isequal, "zephir" ?DynRemoteZephir
& stop
%end if
