%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /backups/router/usr/local/opnsense/service/templates/OPNsense/Syslog/
Upload File :
Create Path :
Current File : //backups/router/usr/local/opnsense/service/templates/OPNsense/Syslog/syslog-ng-local.conf

{% if OPNsense.Syslog.general.loglocal == '1' %}
{% set all_filters = [] %}
{%  for sfilename in helpers.glob("OPNsense/Syslog/local/*.conf") %}{%
        include sfilename without context
%} {%
        set local_config = sfilename.split('/')[-1].replace('.conf', '')
%} {%
        set local_config_filter = "f_local_" + local_config
%} {%
        do all_filters.append(local_config_filter)
%}

destination d_local_{{ local_config }} {
    file(
        "/var/log/{{local_config.replace('_', '/')}}/{{local_config.split('_')[-1]}}_${YEAR}${MONTH}${DAY}.log"
        create-dirs(yes)
        flags(syslog-protocol)
    );
};
log {
    source(s_all);
    filter({{local_config_filter}});
    destination(d_local_{{ local_config }});
};

{%  endfor %}
################################################################################
# not captured elsewhere, but relevant, send to system[__].log
################################################################################
filter f_local_system {
    not filter({{ all_filters|join(') and not filter(') }})
    and level(notice..emerg)
};

destination d_local_system {
    file(
        "/var/log/system/system_${YEAR}${MONTH}${DAY}.log"
        create-dirs(yes)
        flags(syslog-protocol)
    );
};

log {
    source(s_all);
    filter(f_local_system);
    destination(d_local_system);
};
{% endif %}

Zerion Mini Shell 1.0