summaryrefslogtreecommitdiff
path: root/src/conf_mode/system_syslog.py
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-09-12 21:32:03 +0200
committerChristian Breunig <christian@breunig.cc>2024-09-12 21:32:55 +0200
commit042be39ccabb43a766e04a447207610ff017bd7d (patch)
tree28da1ddd11c08491fefe062130de2e4b99889710 /src/conf_mode/system_syslog.py
parent8f0a70cff733ade52a4c17b9e5062e5134098c1e (diff)
downloadvyos-1x-042be39ccabb43a766e04a447207610ff017bd7d.tar.gz
vyos-1x-042be39ccabb43a766e04a447207610ff017bd7d.zip
syslog: T5367: add format option to include timezone in message
Add CLI option to include the systems timezone in the syslog message sent to a collector. This can be enabled using: set system syslog host <hostname> format include-timezone
Diffstat (limited to 'src/conf_mode/system_syslog.py')
-rwxr-xr-xsrc/conf_mode/system_syslog.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/conf_mode/system_syslog.py b/src/conf_mode/system_syslog.py
index 07fbb0734..2497c5bb6 100755
--- a/src/conf_mode/system_syslog.py
+++ b/src/conf_mode/system_syslog.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2018-2023 VyOS maintainers and contributors
+# Copyright (C) 2018-2024 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -18,6 +18,7 @@ import os
from sys import exit
+from vyos.base import Warning
from vyos.config import Config
from vyos.configdict import is_node_changed
from vyos.configverify import verify_vrf
@@ -58,6 +59,12 @@ def verify(syslog):
if not syslog:
return None
+ if 'host' in syslog:
+ for host, host_options in syslog['host'].items():
+ if 'protocol' in host_options and host_options['protocol'] == 'udp':
+ if 'format' in host_options and 'octet_counted' in host_options['format']:
+ Warning(f'Syslog UDP transport for "{host}" should not use octet-counted format!')
+
verify_vrf(syslog)
def generate(syslog):