summaryrefslogtreecommitdiff
path: root/src/conf_mode/system-syslog.py
diff options
context:
space:
mode:
authorhagbard <vyosdev@derith.de>2019-12-06 07:59:59 -0800
committerhagbard <vyosdev@derith.de>2019-12-06 08:01:51 -0800
commit123e7f8c07f56ad868604bcb42f8da095f97b2c9 (patch)
treec80e9d096fa3245aec2fb652c1a1934fbf057120 /src/conf_mode/system-syslog.py
parenta45c23b57f09a805843c72d3dee5256eb118497a (diff)
downloadvyos-1x-123e7f8c07f56ad868604bcb42f8da095f97b2c9.tar.gz
vyos-1x-123e7f8c07f56ad868604bcb42f8da095f97b2c9.zip
syslog: T1845: syslog host no longer accepts a port
- created 'set system syslog host <ip address> port'
Diffstat (limited to 'src/conf_mode/system-syslog.py')
-rwxr-xr-xsrc/conf_mode/system-syslog.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/conf_mode/system-syslog.py b/src/conf_mode/system-syslog.py
index c4f3d2c9c..950a185bc 100755
--- a/src/conf_mode/system-syslog.py
+++ b/src/conf_mode/system-syslog.py
@@ -53,10 +53,18 @@ $outchannel {{file}},{{files[file]['log-file']}},{{files[file]['max-size']}},{{f
## remote logging
{% for host in hosts %}
{% if hosts[host]['proto'] == 'tcp' %}
+{% if hosts[host]['port'] %}
+{{hosts[host]['selectors']}} @@{{host}}:{{hosts[host]['port']}}
+{% else %}
{{hosts[host]['selectors']}} @@{{host}}
+{% endif %}
+{% else %}
+{% if hosts[host]['port'] %}
+{{hosts[host]['selectors']}} @{{host}}:{{hosts[host]['port']}}
{% else %}
{{hosts[host]['selectors']}} @{{host}}
{% endif %}
+{% endif %}
{% endfor %}
{% endif %}
{% if user %}
@@ -177,13 +185,14 @@ def get_config():
# set system syslog host
if c.exists('host'):
- proto = 'udp'
rhosts = c.list_nodes('host')
for rhost in rhosts:
for fac in c.list_nodes('host ' + rhost + ' facility'):
if c.exists('host ' + rhost + ' facility ' + fac + ' protocol'):
proto = c.return_value(
'host ' + rhost + ' facility ' + fac + ' protocol')
+ else:
+ proto = 'udp'
config_data['hosts'].update(
{
@@ -193,6 +202,8 @@ def get_config():
}
}
)
+ if c.exists('host ' + rhost + ' port'):
+ config_data['hosts'][rhost]['port'] = c.return_value(['host', rhost, 'port'])
# set system syslog user
if c.exists('user'):
@@ -261,7 +272,8 @@ def generate(c):
def verify(c):
if c == None:
return None
- #
+
+ ### may be obsolete
# /etc/rsyslog.conf is generated somewhere and copied over the original (exists in /opt/vyatta/etc/rsyslog.conf)
# it interferes with the global logging, to make sure we are using a single base, template is enforced here
#
@@ -273,6 +285,7 @@ def verify(c):
# /var/log/vyos-rsyslog were the old files, we may want to clean those up, but currently there
# is a chance that someone still needs it, so I don't automatically remove
# them
+ ###
if c == None:
return None