summaryrefslogtreecommitdiff
path: root/data/templates/rsyslog/rsyslog.conf.j2
blob: 2e3d19afd01eefe2b45e3b18f6ba0e288181d2df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
### Autogenerated by system_syslog.py ###

{% if global.marker is vyos_defined %}
$ModLoad immark
{%     if global.marker.interval is vyos_defined %}
$MarkMessagePeriod {{ global.marker.interval }}
{%     endif %}
{% endif %}
{% if global.preserve_fqdn is vyos_defined %}
$PreserveFQDN on
{% endif %}

{% if global.local_host_name is vyos_defined %}
$LocalHostName {{ global.local_host_name }}
{% endif %}

# We always log to /var/log/messages
$outchannel global,/var/log/messages,262144,/usr/sbin/logrotate {{ logrotate }}
{% if global.facility is vyos_defined %}
{%     set tmp = [] %}
{%     for facility, facility_options in global.facility.items() %}
{%         set _ = tmp.append(facility.replace('all', '*') + '.' + facility_options.level.replace('all', '*')) %}
{%     endfor %}
{{ tmp | join(';') }} :omfile:$global
{% endif %}

{% if console.facility is vyos_defined %}
# Console logging
{%     set tmp = [] %}
{%     for facility, facility_options in console.facility.items() %}
{%         set _ = tmp.append(facility.replace('all', '*') + '.' + facility_options.level.replace('all', '*')) %}
{%     endfor %}
{{ tmp | join(';') }} /dev/console
{% endif %}

{% if remote is vyos_defined %}
# Remote logging
{%     for remote_name, remote_options in remote.items() %}
{%         set tmp = [] %}
{%         if remote_options.facility is vyos_defined %}
{%             for facility, facility_options in remote_options.facility.items() %}
{%                 set _ = tmp.append(facility.replace('all', '*') + '.' + facility_options.level.replace('all', '*')) %}
{%             endfor %}
{%         endif %}
{%         if remote_options.protocol is vyos_defined('tcp') %}
{{ tmp | join(';') }} @@{{ '(o)' if remote_options.format.octet_counted is vyos_defined }}{{ remote_name | bracketize_ipv6 }}:{{ remote_options.port }}{{ ';RSYSLOG_SyslogProtocol23Format' if remote_options.format.include_timezone is vyos_defined }}
{%         else %}
{{ tmp | join(';') }} @{{ remote_name | bracketize_ipv6 }}:{{ remote_options.port }}{{ ';RSYSLOG_SyslogProtocol23Format' if remote_options.format.include_timezone is vyos_defined }}
{%         endif %}
{%     endfor %}
{% endif %}