summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2025-01-08 20:41:03 +0100
committerChristian Breunig <christian@breunig.cc>2025-02-03 07:16:07 +0100
commit395e3cb72c521ea9d62c0efd1620e679fc709cda (patch)
tree3b77c5471a2bece28be59b6c99cee4452af2ec64
parent6912eb2e5075ec2e5e326d10c127d7c81f4fbe47 (diff)
downloadvyos-1x-395e3cb72c521ea9d62c0efd1620e679fc709cda.tar.gz
vyos-1x-395e3cb72c521ea9d62c0efd1620e679fc709cda.zip
syslog: T6989: remove "file" logging destination
-rw-r--r--data/templates/rsyslog/rsyslog.conf.j214
-rw-r--r--interface-definitions/include/version/system-version.xml.i2
-rw-r--r--interface-definitions/system_syslog.xml.in39
-rw-r--r--src/migration-scripts/system/28-to-2929
4 files changed, 30 insertions, 54 deletions
diff --git a/data/templates/rsyslog/rsyslog.conf.j2 b/data/templates/rsyslog/rsyslog.conf.j2
index 253a4bee2..67c062ab9 100644
--- a/data/templates/rsyslog/rsyslog.conf.j2
+++ b/data/templates/rsyslog/rsyslog.conf.j2
@@ -24,20 +24,6 @@ $outchannel global,/var/log/messages,262144,/usr/sbin/logrotate {{ logrotate }}
{{ tmp | join(';') }} :omfile:$global
{% endif %}
-{% if file is vyos_defined %}
-# File based configuration section
-{% for file_name, file_options in file.items() %}
-{% set tmp = [] %}
-$outchannel {{ file_name }},/var/log/user/{{ file_name }},{{ file_options.archive.size }},/usr/sbin/logrotate {{ logrotate }}
-{% if file_options.facility is vyos_defined %}
-{% for facility, facility_options in file_options.facility.items() %}
-{% set _ = tmp.append(facility.replace('all', '*') + '.' + facility_options.level.replace('all', '*')) %}
-{% endfor %}
-{% endif %}
-{{ tmp | join(';') }} :omfile:${{ file }}
-{% endfor %}
-{% endif %}
-
{% if console.facility is vyos_defined %}
# Console logging
{% set tmp = [] %}
diff --git a/interface-definitions/include/version/system-version.xml.i b/interface-definitions/include/version/system-version.xml.i
index 3ecf124c7..5cdece74a 100644
--- a/interface-definitions/include/version/system-version.xml.i
+++ b/interface-definitions/include/version/system-version.xml.i
@@ -1,3 +1,3 @@
<!-- include start from include/version/system-version.xml.i -->
-<syntaxVersion component='system' version='28'></syntaxVersion>
+<syntaxVersion component='system' version='29'></syntaxVersion>
<!-- include end -->
diff --git a/interface-definitions/system_syslog.xml.in b/interface-definitions/system_syslog.xml.in
index 0a9a00572..1d5b3635f 100644
--- a/interface-definitions/system_syslog.xml.in
+++ b/interface-definitions/system_syslog.xml.in
@@ -106,45 +106,6 @@
</leafNode>
</children>
</node>
- <tagNode name="file">
- <properties>
- <help>Logging to a file</help>
- <constraint>
- <regex>[a-zA-Z0-9\-_.]{1,255}</regex>
- </constraint>
- <constraintErrorMessage>illegal characters in filename or filename longer than 255 characters</constraintErrorMessage>
- </properties>
- <children>
- <node name="archive">
- <properties>
- <help>Log file size and rotation characteristics</help>
- </properties>
- <children>
- <leafNode name="file">
- <properties>
- <help>Number of saved files</help>
- <constraint>
- <regex>[0-9]+</regex>
- </constraint>
- <constraintErrorMessage>illegal characters in number of files</constraintErrorMessage>
- </properties>
- <defaultValue>5</defaultValue>
- </leafNode>
- <leafNode name="size">
- <properties>
- <help>Size of log files in kbytes</help>
- <constraint>
- <regex>[0-9]+</regex>
- </constraint>
- <constraintErrorMessage>illegal characters in size</constraintErrorMessage>
- </properties>
- <defaultValue>256</defaultValue>
- </leafNode>
- </children>
- </node>
- #include <include/syslog-facility.xml.i>
- </children>
- </tagNode>
<node name="console">
<properties>
<help>logging to serial console</help>
diff --git a/src/migration-scripts/system/28-to-29 b/src/migration-scripts/system/28-to-29
new file mode 100644
index 000000000..e12063fc4
--- /dev/null
+++ b/src/migration-scripts/system/28-to-29
@@ -0,0 +1,29 @@
+# Copyright 2025 VyOS maintainers and contributors <maintainers@vyos.io>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+# T6989:
+# - remove syslog arbitrary file logging
+# - remove syslog user console logging
+
+from vyos.configtree import ConfigTree
+
+base = ['system', 'syslog']
+
+def migrate(config: ConfigTree) -> None:
+ if not config.exists(base):
+ return
+
+ if config.exists(base + ['file']):
+ config.delete(base + ['file'])