summaryrefslogtreecommitdiff
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
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'
-rw-r--r--interface-definitions/system-syslog.xml13
-rwxr-xr-xsrc/conf_mode/system-syslog.py17
2 files changed, 28 insertions, 2 deletions
diff --git a/interface-definitions/system-syslog.xml b/interface-definitions/system-syslog.xml
index 2d6af5395..8f4b105c8 100644
--- a/interface-definitions/system-syslog.xml
+++ b/interface-definitions/system-syslog.xml
@@ -191,6 +191,19 @@
</valueHelp>
</properties>
<children>
+ <leafNode name="port">
+ <properties>
+ <help>Destination port</help>
+ <valueHelp>
+ <format>1-65535</format>
+ <description>Destination port</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-65535"/>
+ </constraint>
+ <constraintErrorMessage>Invalid destination port value</constraintErrorMessage>
+ </properties>
+ </leafNode>
<tagNode name="facility">
<properties>
<help>Facility for logging</help>
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