summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhagbard <vyosdev@derith.de>2019-03-07 13:07:52 -0800
committerhagbard <vyosdev@derith.de>2019-03-07 13:07:52 -0800
commitead2e596726539724526ebb1dc8334c1aa6c221a (patch)
tree807561f7ad3ceccbd96158068cbd2ebf948f6556
parentaaaacbed391247e34c91b7911d5d2a367f7798d7 (diff)
downloadvyos-1x-ead2e596726539724526ebb1dc8334c1aa6c221a.tar.gz
vyos-1x-ead2e596726539724526ebb1dc8334c1aa6c221a.zip
[rsyslog] T1282 - Configure VyOS to send syslog messages to remote syslog using fully-qualified domain name
-rw-r--r--interface-definitions/syslog.xml6
-rwxr-xr-xsrc/conf_mode/syslog.py19
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 @@
</leafNode>
</children>
</node>
+ <leafNode name ="preserve-fqdn">
+ <properties>
+ <help>uses FQDN for logging</help>
+ <valueless />
+ </properties>
+ </leafNode>
</children>
</node>
<tagNode name="file">
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
###