From ead2e596726539724526ebb1dc8334c1aa6c221a Mon Sep 17 00:00:00 2001 From: hagbard Date: Thu, 7 Mar 2019 13:07:52 -0800 Subject: [rsyslog] T1282 - Configure VyOS to send syslog messages to remote syslog using fully-qualified domain name --- interface-definitions/syslog.xml | 6 ++++++ src/conf_mode/syslog.py | 19 +++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/interface-definitions/syslog.xml b/interface-definitions/syslog.xml index a1479128c..3c8d2ebe2 100644 --- a/interface-definitions/syslog.xml +++ b/interface-definitions/syslog.xml @@ -535,6 +535,12 @@ + + + uses FQDN for logging + + + diff --git a/src/conf_mode/syslog.py b/src/conf_mode/syslog.py index f8f8d9457..e726a5755 100755 --- a/src/conf_mode/syslog.py +++ b/src/conf_mode/syslog.py @@ -30,12 +30,15 @@ from vyos import ConfigError configs = ''' ## generated by syslog.py ## ## file based logging -{% if files['global']['marker'] %} +{% if files['global']['marker'] -%} $ModLoad immark {% if files['global']['marker-interval'] %} $MarkMessagePeriod {{files['global']['marker-interval']}} {% endif %} -{% endif %} +{% endif -%} +{% if files['global']['preserver_fqdn'] -%} +$PreserveFQDN on +{% endif -%} {% for file in files %} $outchannel {{file}},{{files[file]['log-file']}},{{files[file]['max-size']}},{{files[file]['action-on-max-size']}} {{files[file]['selectors']}} :omfile:${{file}} @@ -99,11 +102,12 @@ def get_config(): config_data['files'].update( { 'global' : { - 'log-file' : '/var/log/messages', - 'max-size' : 262144, + 'log-file' : '/var/log/messages', + 'max-size' : 262144, 'action-on-max-size' : '/usr/sbin/logrotate /etc/logrotate.d/vyos-rsyslog', - 'selectors' : '*.notice;local7.debug', - 'max-files' : '5' + 'selectors' : '*.notice;local7.debug', + 'max-files' : '5', + 'preserver_fqdn' : False } } ) @@ -118,6 +122,9 @@ def get_config(): config_data['files']['global']['max-size'] = int(c.return_value('global archive size'))* 1024 if c.exists('global archive files'): config_data['files']['global']['max-files'] = c.return_value('global archive files') + if c.exists('global preserve-fqdn'): + config_data['files']['global']['preserver_fqdn'] = True + ### # set system syslog file ### -- cgit v1.2.3