Skip to content

Commit

Permalink
syslog: T6989: move up "mark" one level in CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
c-po committed Jan 15, 2025
1 parent 58bd7a5 commit 8fae2f2
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 23 deletions.
4 changes: 2 additions & 2 deletions data/templates/rsyslog/rsyslog.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
38 changes: 19 additions & 19 deletions interface-definitions/system_syslog.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
1 change: 1 addition & 0 deletions smoketest/config-tests/basic-vyos
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
3 changes: 3 additions & 0 deletions smoketest/configs/basic-vyos
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ system {
facility security {
level info
}
marker {
interval 1000
}
preserve-fqdn
}
host syslog.vyos.net {
Expand Down
3 changes: 1 addition & 2 deletions smoketest/scripts/cli/test_system_syslog.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ def test_console(self):
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'},
Expand Down
7 changes: 7 additions & 0 deletions src/migration-scripts/system/28-to-29
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down

0 comments on commit 8fae2f2

Please sign in to comment.