summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsever-sever <v.gletenko@vyos.io>2020-10-16 12:50:36 +0000
committersever-sever <v.gletenko@vyos.io>2020-10-17 08:15:51 +0000
commit0eecfabd74f1f8dec96bf4bb64609eaa609edaef (patch)
tree3087fae0b50548045537c58464e30b9af09f5cb8
parenta5a77c47168b888bf008dab139d1e5d023568bfe (diff)
downloadvyos-1x-0eecfabd74f1f8dec96bf4bb64609eaa609edaef.tar.gz
vyos-1x-0eecfabd74f1f8dec96bf4bb64609eaa609edaef.zip
syslog: T2938: Add format octet-counted for syslog conf-mode
-rw-r--r--data/templates/syslog/rsyslog.conf.tmpl22
-rw-r--r--interface-definitions/system-syslog.xml.in13
-rwxr-xr-xsrc/conf_mode/system-syslog.py6
3 files changed, 32 insertions, 9 deletions
diff --git a/data/templates/syslog/rsyslog.conf.tmpl b/data/templates/syslog/rsyslog.conf.tmpl
index bc3f7667b..a610d132f 100644
--- a/data/templates/syslog/rsyslog.conf.tmpl
+++ b/data/templates/syslog/rsyslog.conf.tmpl
@@ -22,19 +22,23 @@ $outchannel {{file}},{{files[file]['log-file']}},{{files[file]['max-size']}},{{f
{% if hosts %}
## remote logging
{% for host in hosts %}
-{% if hosts[host]['proto'] == 'tcp' %}
-{% if hosts[host]['port'] %}
+{% if hosts[host]['proto'] == 'tcp' %}
+{% if hosts[host]['port'] %}
+{% if hosts[host]['oct_count'] %}
+{{hosts[host]['selectors']}} @@(o){{host}}:{{hosts[host]['port']}};RSYSLOG_SyslogProtocol23Format
+{% else %}
{{hosts[host]['selectors']}} @@{{host}}:{{hosts[host]['port']}}
-{% else %}
+{% endif %}
+{% else %}
{{hosts[host]['selectors']}} @@{{host}}
-{% endif %}
-{% else %}
-{% if hosts[host]['port'] %}
+{% endif %}
+{% else %}
+{% if hosts[host]['port'] %}
{{hosts[host]['selectors']}} @{{host}}:{{hosts[host]['port']}}
-{% else %}
+{% else %}
{{hosts[host]['selectors']}} @{{host}}
-{% endif %}
-{% endif %}
+{% endif %}
+{% endif %}
{% endfor %}
{% endif %}
{% if user %}
diff --git a/interface-definitions/system-syslog.xml.in b/interface-definitions/system-syslog.xml.in
index 194cdb851..b357bb036 100644
--- a/interface-definitions/system-syslog.xml.in
+++ b/interface-definitions/system-syslog.xml.in
@@ -382,6 +382,19 @@
</leafNode>
</children>
</tagNode>
+ <node name="format">
+ <properties>
+ <help>Logging format</help>
+ </properties>
+ <children>
+ <leafNode name="octet-counted">
+ <properties>
+ <help>Allows for the transmission of all characters inside a syslog message</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
</children>
</tagNode>
<node name="global">
diff --git a/src/conf_mode/system-syslog.py b/src/conf_mode/system-syslog.py
index d29109c41..b1daf7a82 100755
--- a/src/conf_mode/system-syslog.py
+++ b/src/conf_mode/system-syslog.py
@@ -146,6 +146,12 @@ def get_config(config=None):
config_data['hosts'][rhost][
'port'] = c.return_value(['host', rhost, 'port'])
+ # set system syslog host x.x.x.x format octet-counted
+ if c.exists('host ' + rhost + ' format octet-counted'):
+ config_data['hosts'][rhost]['oct_count'] = True
+ else:
+ config_data['hosts'][rhost]['oct_count'] = False
+
# set system syslog user
if c.exists('user'):
usrs = c.list_nodes('user')