diff options
author | Christian Breunig <christian@breunig.cc> | 2025-01-15 20:45:42 +0100 |
---|---|---|
committer | Christian Breunig <christian@breunig.cc> | 2025-02-03 07:16:07 +0100 |
commit | b9c43b19acb6f649bb6f64c75ab63df768e360c9 (patch) | |
tree | 05c8b1da45146e3cd39b7058ac0c0be2fccd1c3f | |
parent | 20ab585a68982c4635c4e5a1ee5bbcc219feaebc (diff) | |
download | vyos-1x-b9c43b19acb6f649bb6f64c75ab63df768e360c9.tar.gz vyos-1x-b9c43b19acb6f649bb6f64c75ab63df768e360c9.zip |
syslog: T6989: move up "global marker" one level in CLI
-rw-r--r-- | data/templates/rsyslog/rsyslog.conf.j2 | 4 | ||||
-rw-r--r-- | interface-definitions/system_syslog.xml.in | 38 | ||||
-rw-r--r-- | smoketest/config-tests/basic-vyos | 1 | ||||
-rw-r--r-- | smoketest/configs/basic-vyos | 3 | ||||
-rwxr-xr-x | smoketest/scripts/cli/test_system_syslog.py | 3 | ||||
-rw-r--r-- | src/migration-scripts/system/28-to-29 | 7 |
6 files changed, 33 insertions, 23 deletions
diff --git a/data/templates/rsyslog/rsyslog.conf.j2 b/data/templates/rsyslog/rsyslog.conf.j2 index bc98329b2..26d62a23f 100644 --- a/data/templates/rsyslog/rsyslog.conf.j2 +++ b/data/templates/rsyslog/rsyslog.conf.j2 @@ -47,9 +47,9 @@ global(workDirectory="/var/spool/rsyslog") # Send emergency messages to all logged-in users *.emerg action(type="omusrmsg" users="*") -{% if global.marker is vyos_defined %} +{% if marker is vyos_defined %} # Load the immark module for periodic --MARK-- message capability -module(load="immark" interval="{{ global.marker.interval }}") +module(load="immark" interval="{{ marker.interval }}") {% endif %} {% if preserve_fqdn is vyos_defined %} # Preserve the fully qualified domain name (FQDN) in log messages diff --git a/interface-definitions/system_syslog.xml.in b/interface-definitions/system_syslog.xml.in index 09cfd3dd4..1ee5a7687 100644 --- a/interface-definitions/system_syslog.xml.in +++ b/interface-definitions/system_syslog.xml.in @@ -71,27 +71,27 @@ </properties> <children> #include <include/syslog-facility.xml.i> - <node name="marker"> + </children> + </node> + <node name="marker"> + <properties> + <help>Mark messages sent to syslog</help> + </properties> + <children> + <leafNode name="interval"> <properties> - <help>Mark messages sent to syslog</help> + <help>Mark message interval</help> + <valueHelp> + <format>u32:1-65535</format> + <description>Time in seconds</description> + </valueHelp> + <constraint> + <validator name="numeric" argument="--range 1-86400"/> + </constraint> + <constraintErrorMessage>Port number must be in range 1 to 86400</constraintErrorMessage> </properties> - <children> - <leafNode name="interval"> - <properties> - <help>Mark message interval</help> - <valueHelp> - <format>u32:1-65535</format> - <description>Time in seconds</description> - </valueHelp> - <constraint> - <validator name="numeric" argument="--range 1-86400"/> - </constraint> - <constraintErrorMessage>Port number must be in range 1 to 86400</constraintErrorMessage> - </properties> - <defaultValue>1200</defaultValue> - </leafNode> - </children> - </node> + <defaultValue>1200</defaultValue> + </leafNode> </children> </node> <leafNode name="preserve-fqdn"> diff --git a/smoketest/config-tests/basic-vyos b/smoketest/config-tests/basic-vyos index eaa61c56d..94a4d139e 100644 --- a/smoketest/config-tests/basic-vyos +++ b/smoketest/config-tests/basic-vyos @@ -95,6 +95,7 @@ set system syslog console facility mail level 'info' set system syslog global facility all level 'info' set system syslog global facility auth level 'info' set system syslog global facility local7 level 'debug' +set system syslog marker interval '1000' set system syslog preserve-fqdn set system syslog remote syslog.vyos.net facility auth level 'warning' set system syslog remote syslog.vyos.net facility local7 level 'notice' diff --git a/smoketest/configs/basic-vyos b/smoketest/configs/basic-vyos index 242f3d1de..527e620da 100644 --- a/smoketest/configs/basic-vyos +++ b/smoketest/configs/basic-vyos @@ -236,6 +236,9 @@ system { facility security { level info } + marker { + interval 1000 + } preserve-fqdn } host syslog.vyos.net { diff --git a/smoketest/scripts/cli/test_system_syslog.py b/smoketest/scripts/cli/test_system_syslog.py index b1aaa53a5..1233bf12b 100755 --- a/smoketest/scripts/cli/test_system_syslog.py +++ b/smoketest/scripts/cli/test_system_syslog.py @@ -75,8 +75,7 @@ class TestRSYSLOGService(VyOSUnitTestSHIM.TestCase): def test_global(self): hostname = 'vyos123' domain_name = 'example.local' - default_marker_interval = default_value(base_path + ['global', - 'marker', 'interval']) + default_marker_interval = default_value(base_path + ['marker', 'interval']) facility = { 'auth': {'level': 'info'}, diff --git a/src/migration-scripts/system/28-to-29 b/src/migration-scripts/system/28-to-29 index dadfc994a..9716e9e90 100644 --- a/src/migration-scripts/system/28-to-29 +++ b/src/migration-scripts/system/28-to-29 @@ -41,6 +41,13 @@ def migrate(config: ConfigTree) -> None: config.delete(base + ['global', 'preserve-fqdn']) config.set(base + ['preserve-fqdn']) + # Move "global marker" one CLI level up, as it relates to all + # logging targets (console, global and remote) + marker_base = base + ['global', 'marker'] + if config.exists(marker_base): + config.copy(marker_base, base + ['marker']) + config.delete(marker_base) + # Rename host x.x.x.x -> remote x.x.x.x if config.exists(base + ['host']): config.set(base + ['remote']) |