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

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