2017-01-29 13:33:33 -06:00
|
|
|
###############################################################################
|
|
|
|
# Managed by Ansible
|
|
|
|
# file: ansible/roles/acs/templates/rsyslog.conf.j2
|
|
|
|
###############################################################################
|
|
|
|
#
|
|
|
|
# /etc/rsyslog.conf Configuration file for rsyslog.
|
|
|
|
#
|
|
|
|
# For more information see
|
|
|
|
# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html
|
|
|
|
|
|
|
|
|
|
|
|
#################
|
|
|
|
#### MODULES ####
|
|
|
|
#################
|
|
|
|
|
|
|
|
$ModLoad imuxsock # provides support for local system logging
|
2022-12-20 02:53:58 -06:00
|
|
|
|
|
|
|
{% if SYSLOG_CONFIG is defined %}
|
|
|
|
{% if 'GLOBAL' in SYSLOG_CONFIG %}
|
|
|
|
{% if 'rate_limit_interval' in SYSLOG_CONFIG['GLOBAL']%}
|
|
|
|
{% set rate_limit_interval = SYSLOG_CONFIG['GLOBAL']['rate_limit_interval'] %}
|
|
|
|
{% endif %}
|
|
|
|
{% if 'rate_limit_burst' in SYSLOG_CONFIG['GLOBAL']%}
|
|
|
|
{% set rate_limit_burst = SYSLOG_CONFIG['GLOBAL']['rate_limit_burst'] %}
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if rate_limit_interval is defined %}
|
|
|
|
$SystemLogRateLimitInterval {{ rate_limit_interval }}
|
|
|
|
{% endif %}
|
|
|
|
{% if rate_limit_burst is defined %}
|
|
|
|
$SystemLogRateLimitBurst {{ rate_limit_burst }}
|
|
|
|
{% endif %}
|
|
|
|
|
2017-01-29 13:33:33 -06:00
|
|
|
$ModLoad imklog # provides kernel logging support
|
|
|
|
#$ModLoad immark # provides --MARK-- message capability
|
|
|
|
|
|
|
|
# provides UDP syslog reception
|
|
|
|
$ModLoad imudp
|
2020-06-30 08:29:20 -05:00
|
|
|
$UDPServerAddress {{udp_server_ip}} #bind to localhost before udp server run
|
2017-01-29 13:33:33 -06:00
|
|
|
$UDPServerRun 514
|
|
|
|
|
|
|
|
# provides TCP syslog reception
|
|
|
|
#$ModLoad imtcp
|
|
|
|
#$InputTCPServerRun 514
|
|
|
|
|
|
|
|
|
|
|
|
###########################
|
|
|
|
#### GLOBAL DIRECTIVES ####
|
|
|
|
###########################
|
|
|
|
#
|
|
|
|
# Use traditional timestamp format.
|
|
|
|
# To enable high precision timestamps, comment out the following line.
|
|
|
|
#
|
|
|
|
#$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
|
|
|
|
|
|
|
|
# Define a custom template
|
2017-09-08 20:25:25 -05:00
|
|
|
$template SONiCFileFormat,"%timegenerated%.%timegenerated:::date-subseconds% %HOSTNAME% %syslogseverity-text:::uppercase% %syslogtag%%msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n"
|
2017-04-21 10:22:44 -05:00
|
|
|
$ActionFileDefaultTemplate SONiCFileFormat
|
2017-01-29 13:33:33 -06:00
|
|
|
|
|
|
|
#
|
|
|
|
# Set the default permissions for all log files.
|
|
|
|
#
|
|
|
|
$FileOwner root
|
|
|
|
$FileGroup adm
|
|
|
|
$FileCreateMode 0640
|
|
|
|
$DirCreateMode 0755
|
|
|
|
$Umask 0022
|
|
|
|
|
|
|
|
#
|
|
|
|
# Where to place spool and state files
|
|
|
|
#
|
|
|
|
$WorkDirectory /var/spool/rsyslog
|
|
|
|
|
|
|
|
#
|
|
|
|
# Include all config files in /etc/rsyslog.d/
|
|
|
|
#
|
|
|
|
$IncludeConfig /etc/rsyslog.d/*.conf
|
|
|
|
|
2019-01-29 05:41:40 -06:00
|
|
|
#
|
|
|
|
# Suppress duplicate messages and report "message repeated n times"
|
|
|
|
#
|
|
|
|
$RepeatedMsgReduction on
|
2017-01-29 13:33:33 -06:00
|
|
|
|
|
|
|
###############
|
|
|
|
#### RULES ####
|
|
|
|
###############
|
2022-07-20 02:05:13 -05:00
|
|
|
|
|
|
|
#
|
|
|
|
# Remote syslog logging
|
|
|
|
#
|
|
|
|
|
|
|
|
# The omfwd plug-in provides the core functionality of traditional message forwarding via UDP and plain TCP.
|
|
|
|
# It is a built-in module that does not need to be loaded.
|
|
|
|
|
|
|
|
{% if SYSLOG_SERVER is defined %}
|
|
|
|
{% for server, data in SYSLOG_SERVER.items() %}
|
|
|
|
{% set params_list = [] %}
|
|
|
|
{% if 'source' in data %}
|
|
|
|
{% set dummy = params_list.append('address=' + '"' + data.source|string + '"') %}
|
|
|
|
{% endif %}
|
|
|
|
{% if 'port' in data %}
|
|
|
|
{% set dummy = params_list.append('port=' + '"' + data.port|string + '"') %}
|
|
|
|
{% endif %}
|
|
|
|
{% if 'vrf' in data and data['vrf'] != "default" %}
|
|
|
|
{% set dummy = params_list.append('device=' + '"' + data.vrf|string + '"') %}
|
|
|
|
{% endif %}
|
|
|
|
{% if params_list %}
|
|
|
|
*.* action(type="omfwd" target="{{ server }}" protocol="udp" {{ params_list|join(' ') }} template="SONiCFileFormat")
|
|
|
|
{% else %}
|
|
|
|
*.* action(type="omfwd" target="{{ server }}" protocol="udp" template="SONiCFileFormat")
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|