Page MenuHomeVyOS Platform

No OneTemporary

Size
53 KB
Referenced Files
None
Subscribers
None
diff --git a/data/templates/syslog/override.conf.tmpl b/data/templates/syslog/override.conf.tmpl
new file mode 100644
index 000000000..60c397fa7
--- /dev/null
+++ b/data/templates/syslog/override.conf.tmpl
@@ -0,0 +1,11 @@
+{% set vrf_command = 'ip vrf exec ' + vrf + ' ' if vrf is defined else '' %}
+[Unit]
+StartLimitIntervalSec=0
+
+[Service]
+ExecStart=
+ExecStart={{ vrf_command }}/usr/sbin/rsyslogd -n -iNONE
+Restart=always
+RestartPreventExitStatus=
+RestartSec=10
+RuntimeDirectoryPreserve=yes
diff --git a/interface-definitions/system-syslog.xml.in b/interface-definitions/system-syslog.xml.in
index f3dcae2f3..6d0feba33 100644
--- a/interface-definitions/system-syslog.xml.in
+++ b/interface-definitions/system-syslog.xml.in
@@ -1,962 +1,963 @@
<?xml version="1.0"?>
<interfaceDefinition>
<node name="system">
<children>
<node name="syslog" owner="${vyos_conf_scripts_dir}/system-syslog.py">
<properties>
<help>System logging</help>
<priority>400</priority>
</properties>
<children>
<tagNode name="user">
<properties>
<help>Logging to specific terminal of given user</help>
<constraint>
<regex>[a-z_][a-z0-9_-]{1,31}[$]?</regex>
</constraint>
<constraintErrorMessage>illegal characters in user</constraintErrorMessage>
<valueHelp>
<format>username</format>
<description>user login name</description>
</valueHelp>
</properties>
<children>
<tagNode name="facility">
<properties>
<help>Facility for logging</help>
<completionHelp>
<list>auth authpriv cron daemon kern lpr mail mark news protocols security syslog user uucp local0 local1 local2 local3 local4 local5 local6 local7 all</list>
</completionHelp>
<constraint>
<regex>^(auth|authpriv|cron|daemon|kern|lpr|mail|mark|news|protocols|security|syslog|user|uucp|local0|local1|local2|local3|local4|local5|local6|local7|all)$</regex>
</constraint>
<constraintErrorMessage>Invalid facility type</constraintErrorMessage>
<valueHelp>
<format>all</format>
<description>All facilities excluding "mark"</description>
</valueHelp>
<valueHelp>
<format>auth</format>
<description>Authentication and authorization</description>
</valueHelp>
<valueHelp>
<format>authpriv</format>
<description>Non-system authorization</description>
</valueHelp>
<valueHelp>
<format>cron</format>
<description>Cron daemon</description>
</valueHelp>
<valueHelp>
<format>daemon</format>
<description>System daemons</description>
</valueHelp>
<valueHelp>
<format>kern</format>
<description>Kernel</description>
</valueHelp>
<valueHelp>
<format>lpr</format>
<description>Line printer spooler</description>
</valueHelp>
<valueHelp>
<format>mail</format>
<description>Mail subsystem</description>
</valueHelp>
<valueHelp>
<format>mark</format>
<description>Timestamp</description>
</valueHelp>
<valueHelp>
<format>news</format>
<description>USENET subsystem</description>
</valueHelp>
<valueHelp>
<format>protocols</format>
<description>depricated will be set to local7</description>
</valueHelp>
<valueHelp>
<format>security</format>
<description>depricated will be set to auth</description>
</valueHelp>
<valueHelp>
<format>syslog</format>
<description>Authentication and authorization</description>
</valueHelp>
<valueHelp>
<format>user</format>
<description>Application processes</description>
</valueHelp>
<valueHelp>
<format>uucp</format>
<description>UUCP subsystem</description>
</valueHelp>
<valueHelp>
<format>local0</format>
<description>Local facility 0</description>
</valueHelp>
<valueHelp>
<format>local1</format>
<description>Local facility 1</description>
</valueHelp>
<valueHelp>
<format>local2</format>
<description>Local facility 2</description>
</valueHelp>
<valueHelp>
<format>local3</format>
<description>Local facility 3</description>
</valueHelp>
<valueHelp>
<format>local4</format>
<description>Local facility 4</description>
</valueHelp>
<valueHelp>
<format>local5</format>
<description>Local facility 5</description>
</valueHelp>
<valueHelp>
<format>local6</format>
<description>Local facility 6</description>
</valueHelp>
<valueHelp>
<format>local7</format>
<description>Local facility 7</description>
</valueHelp>
</properties>
<children>
<leafNode name="level">
<properties>
<help>Logging level</help>
<completionHelp>
<list>emerg alert crit err warning notice info debug all</list>
</completionHelp>
<constraint>
<regex>^(emerg|alert|crit|err|warning|notice|info|debug|all)$</regex>
</constraint>
<constraintErrorMessage>Invalid loglevel</constraintErrorMessage>
<valueHelp>
<format>emerg</format>
<description>Emergency messages</description>
</valueHelp>
<valueHelp>
<format>alert</format>
<description>Urgent messages</description>
</valueHelp>
<valueHelp>
<format>crit</format>
<description>Critical messages</description>
</valueHelp>
<valueHelp>
<format>err</format>
<description>Error messages</description>
</valueHelp>
<valueHelp>
<format>warning</format>
<description>Warning messages</description>
</valueHelp>
<valueHelp>
<format>notice</format>
<description>Messages for further investigation</description>
</valueHelp>
<valueHelp>
<format>info</format>
<description>Informational messages</description>
</valueHelp>
<valueHelp>
<format>debug</format>
<description>Debug messages</description>
</valueHelp>
<valueHelp>
<format>all</format>
<description>Log everything</description>
</valueHelp>
</properties>
</leafNode>
</children>
</tagNode>
</children>
</tagNode>
<tagNode name="host">
<properties>
<help>Logging to a remote host</help>
<constraint>
<validator name="ip-address"/>
<validator name="fqdn"/>
</constraint>
<constraintErrorMessage>Invalid host (FQDN or IP address)</constraintErrorMessage>
<valueHelp>
<format>ipv4</format>
<description>Remote syslog server IPv4 address</description>
</valueHelp>
<valueHelp>
<format>hostname</format>
<description>Remote syslog server FQDN</description>
</valueHelp>
</properties>
<children>
<leafNode name="port">
<properties>
<help>Destination port</help>
<valueHelp>
<format>u32:1-65535</format>
<description>Destination port</description>
</valueHelp>
<constraint>
<validator name="numeric" argument="--range 1-65535"/>
</constraint>
<constraintErrorMessage>Invalid destination port value</constraintErrorMessage>
</properties>
</leafNode>
<tagNode name="facility">
<properties>
<help>Facility for logging</help>
<completionHelp>
<list>auth authpriv cron daemon kern lpr mail mark news protocols security syslog user uucp local0 local1 local2 local3 local4 local5 local6 local7 all</list>
</completionHelp>
<constraint>
<regex>^(auth|authpriv|cron|daemon|kern|lpr|mail|mark|news|protocols|security|syslog|user|uucp|local0|local1|local2|local3|local4|local5|local6|local7|all)$</regex>
</constraint>
<constraintErrorMessage>Invalid facility type</constraintErrorMessage>
<valueHelp>
<format>all</format>
<description>All facilities excluding "mark"</description>
</valueHelp>
<valueHelp>
<format>auth</format>
<description>Authentication and authorization</description>
</valueHelp>
<valueHelp>
<format>authpriv</format>
<description>Non-system authorization</description>
</valueHelp>
<valueHelp>
<format>cron</format>
<description>Cron daemon</description>
</valueHelp>
<valueHelp>
<format>daemon</format>
<description>System daemons</description>
</valueHelp>
<valueHelp>
<format>kern</format>
<description>Kernel</description>
</valueHelp>
<valueHelp>
<format>lpr</format>
<description>Line printer spooler</description>
</valueHelp>
<valueHelp>
<format>mail</format>
<description>Mail subsystem</description>
</valueHelp>
<valueHelp>
<format>mark</format>
<description>Timestamp</description>
</valueHelp>
<valueHelp>
<format>news</format>
<description>USENET subsystem</description>
</valueHelp>
<valueHelp>
<format>protocols</format>
<description>depricated will be set to local7</description>
</valueHelp>
<valueHelp>
<format>security</format>
<description>depricated will be set to auth</description>
</valueHelp>
<valueHelp>
<format>syslog</format>
<description>Authentication and authorization</description>
</valueHelp>
<valueHelp>
<format>user</format>
<description>Application processes</description>
</valueHelp>
<valueHelp>
<format>uucp</format>
<description>UUCP subsystem</description>
</valueHelp>
<valueHelp>
<format>local0</format>
<description>Local facility 0</description>
</valueHelp>
<valueHelp>
<format>local1</format>
<description>Local facility 1</description>
</valueHelp>
<valueHelp>
<format>local2</format>
<description>Local facility 2</description>
</valueHelp>
<valueHelp>
<format>local3</format>
<description>Local facility 3</description>
</valueHelp>
<valueHelp>
<format>local4</format>
<description>Local facility 4</description>
</valueHelp>
<valueHelp>
<format>local5</format>
<description>Local facility 5</description>
</valueHelp>
<valueHelp>
<format>local6</format>
<description>Local facility 6</description>
</valueHelp>
<valueHelp>
<format>local7</format>
<description>Local facility 7</description>
</valueHelp>
</properties>
<children>
<leafNode name="protocol">
<properties>
<help>syslog communication protocol</help>
<valueHelp>
<format>udp</format>
<description>send log messages to remote syslog server over udp</description>
</valueHelp>
<valueHelp>
<format>tcp</format>
<description>send log messages to remote syslog server over tcp</description>
</valueHelp>
<completionHelp>
<list>udp tcp</list>
</completionHelp>
<constraint>
<regex>^(udp|tcp)$</regex>
</constraint>
<constraintErrorMessage>invalid protocol name</constraintErrorMessage>
</properties>
</leafNode>
<leafNode name="level">
<properties>
<help>Logging level</help>
<completionHelp>
<list>emerg alert crit err warning notice info debug all</list>
</completionHelp>
<constraint>
<regex>^(emerg|alert|crit|err|warning|notice|info|debug|all)$</regex>
</constraint>
<constraintErrorMessage>Invalid loglevel</constraintErrorMessage>
<valueHelp>
<format>emerg</format>
<description>Emergency messages</description>
</valueHelp>
<valueHelp>
<format>alert</format>
<description>Urgent messages</description>
</valueHelp>
<valueHelp>
<format>crit</format>
<description>Critical messages</description>
</valueHelp>
<valueHelp>
<format>err</format>
<description>Error messages</description>
</valueHelp>
<valueHelp>
<format>warning</format>
<description>Warning messages</description>
</valueHelp>
<valueHelp>
<format>notice</format>
<description>Messages for further investigation</description>
</valueHelp>
<valueHelp>
<format>info</format>
<description>Informational messages</description>
</valueHelp>
<valueHelp>
<format>debug</format>
<description>Debug messages</description>
</valueHelp>
<valueHelp>
<format>all</format>
<description>Log everything</description>
</valueHelp>
</properties>
</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">
<properties>
<help>Logging to system standard location</help>
</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 (default is 5)</help>
<constraint>
<regex>[0-9]+</regex>
</constraint>
<constraintErrorMessage>illegal characters in number of files</constraintErrorMessage>
</properties>
</leafNode>
<leafNode name="size">
<properties>
<help>Size of log files (in kbytes, default is 256)</help>
<constraint>
<regex>[0-9]+</regex>
</constraint>
<constraintErrorMessage>illegal characters in size</constraintErrorMessage>
</properties>
</leafNode>
</children>
</node>
<tagNode name="facility">
<properties>
<help>Facility for logging</help>
<completionHelp>
<list>auth authpriv cron daemon kern lpr mail mark news protocols security syslog user uucp local0 local1 local2 local3 local4 local5 local6 local7 all</list>
</completionHelp>
<constraint>
<regex>^(auth|authpriv|cron|daemon|kern|lpr|mail|mark|news|protocols|security|syslog|user|uucp|local0|local1|local2|local3|local4|local5|local6|local7|all)$</regex>
</constraint>
<constraintErrorMessage>Invalid facility type</constraintErrorMessage>
<valueHelp>
<format>all</format>
<description>All facilities excluding "mark"</description>
</valueHelp>
<valueHelp>
<format>auth</format>
<description>Authentication and authorization</description>
</valueHelp>
<valueHelp>
<format>authpriv</format>
<description>Non-system authorization</description>
</valueHelp>
<valueHelp>
<format>cron</format>
<description>Cron daemon</description>
</valueHelp>
<valueHelp>
<format>daemon</format>
<description>System daemons</description>
</valueHelp>
<valueHelp>
<format>kern</format>
<description>Kernel</description>
</valueHelp>
<valueHelp>
<format>lpr</format>
<description>Line printer spooler</description>
</valueHelp>
<valueHelp>
<format>mail</format>
<description>Mail subsystem</description>
</valueHelp>
<valueHelp>
<format>mark</format>
<description>Timestamp</description>
</valueHelp>
<valueHelp>
<format>news</format>
<description>USENET subsystem</description>
</valueHelp>
<valueHelp>
<format>protocols</format>
<description>depricated will be set to local7</description>
</valueHelp>
<valueHelp>
<format>security</format>
<description>depricated will be set to auth</description>
</valueHelp>
<valueHelp>
<format>syslog</format>
<description>Authentication and authorization</description>
</valueHelp>
<valueHelp>
<format>user</format>
<description>Application processes</description>
</valueHelp>
<valueHelp>
<format>uucp</format>
<description>UUCP subsystem</description>
</valueHelp>
<valueHelp>
<format>local0</format>
<description>Local facility 0</description>
</valueHelp>
<valueHelp>
<format>local1</format>
<description>Local facility 1</description>
</valueHelp>
<valueHelp>
<format>local2</format>
<description>Local facility 2</description>
</valueHelp>
<valueHelp>
<format>local3</format>
<description>Local facility 3</description>
</valueHelp>
<valueHelp>
<format>local4</format>
<description>Local facility 4</description>
</valueHelp>
<valueHelp>
<format>local5</format>
<description>Local facility 5</description>
</valueHelp>
<valueHelp>
<format>local6</format>
<description>Local facility 6</description>
</valueHelp>
<valueHelp>
<format>local7</format>
<description>Local facility 7</description>
</valueHelp>
</properties>
<children>
<leafNode name="level">
<properties>
<help>Logging level</help>
<completionHelp>
<list>emerg alert crit err warning notice info debug all</list>
</completionHelp>
<constraint>
<regex>^(emerg|alert|crit|err|warning|notice|info|debug|all)$</regex>
</constraint>
<constraintErrorMessage>Invalid loglevel</constraintErrorMessage>
<valueHelp>
<format>emerg</format>
<description>Emergency messages</description>
</valueHelp>
<valueHelp>
<format>alert</format>
<description>Urgent messages</description>
</valueHelp>
<valueHelp>
<format>crit</format>
<description>Critical messages</description>
</valueHelp>
<valueHelp>
<format>err</format>
<description>Error messages</description>
</valueHelp>
<valueHelp>
<format>warning</format>
<description>Warning messages</description>
</valueHelp>
<valueHelp>
<format>notice</format>
<description>Messages for further investigation</description>
</valueHelp>
<valueHelp>
<format>info</format>
<description>Informational messages</description>
</valueHelp>
<valueHelp>
<format>debug</format>
<description>Debug messages</description>
</valueHelp>
<valueHelp>
<format>all</format>
<description>Log everything</description>
</valueHelp>
</properties>
</leafNode>
</children>
</tagNode>
<node name="marker">
<properties>
<help>mark messages sent to syslog</help>
</properties>
<children>
<leafNode name="interval">
<properties>
<help>time interval how often a mark message is being sent in seconds (default: 1200)</help>
<constraint>
<validator name="numeric" argument="--positive"/>
</constraint>
</properties>
</leafNode>
</children>
</node>
<leafNode name ="preserve-fqdn">
<properties>
<help>uses FQDN for logging</help>
<valueless />
</properties>
</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 (default is 5)</help>
<constraint>
<regex>[0-9]+</regex>
</constraint>
<constraintErrorMessage>illegal characters in number of files</constraintErrorMessage>
</properties>
</leafNode>
<leafNode name="size">
<properties>
<help>Size of log files (in kbytes, default is 256)</help>
<constraint>
<regex>[0-9]+</regex>
</constraint>
<constraintErrorMessage>illegal characters in size</constraintErrorMessage>
</properties>
</leafNode>
</children>
</node>
<tagNode name="facility">
<properties>
<help>Facility for logging</help>
<completionHelp>
<list>auth authpriv cron daemon kern lpr mail mark news protocols security syslog user uucp local0 local1 local2 local3 local4 local5 local6 local7 all</list>
</completionHelp>
<constraint>
<regex>^(auth|authpriv|cron|daemon|kern|lpr|mail|mark|news|protocols|security|syslog|user|uucp|local0|local1|local2|local3|local4|local5|local6|local7|all)$</regex>
</constraint>
<constraintErrorMessage>Invalid facility type</constraintErrorMessage>
<valueHelp>
<format>all</format>
<description>All facilities excluding "mark"</description>
</valueHelp>
<valueHelp>
<format>auth</format>
<description>Authentication and authorization</description>
</valueHelp>
<valueHelp>
<format>authpriv</format>
<description>Non-system authorization</description>
</valueHelp>
<valueHelp>
<format>cron</format>
<description>Cron daemon</description>
</valueHelp>
<valueHelp>
<format>daemon</format>
<description>System daemons</description>
</valueHelp>
<valueHelp>
<format>kern</format>
<description>Kernel</description>
</valueHelp>
<valueHelp>
<format>lpr</format>
<description>Line printer spooler</description>
</valueHelp>
<valueHelp>
<format>mail</format>
<description>Mail subsystem</description>
</valueHelp>
<valueHelp>
<format>mark</format>
<description>Timestamp</description>
</valueHelp>
<valueHelp>
<format>news</format>
<description>USENET subsystem</description>
</valueHelp>
<valueHelp>
<format>protocols</format>
<description>depricated will be set to local7</description>
</valueHelp>
<valueHelp>
<format>security</format>
<description>depricated will be set to auth</description>
</valueHelp>
<valueHelp>
<format>syslog</format>
<description>Authentication and authorization</description>
</valueHelp>
<valueHelp>
<format>user</format>
<description>Application processes</description>
</valueHelp>
<valueHelp>
<format>uucp</format>
<description>UUCP subsystem</description>
</valueHelp>
<valueHelp>
<format>local0</format>
<description>Local facility 0</description>
</valueHelp>
<valueHelp>
<format>local1</format>
<description>Local facility 1</description>
</valueHelp>
<valueHelp>
<format>local2</format>
<description>Local facility 2</description>
</valueHelp>
<valueHelp>
<format>local3</format>
<description>Local facility 3</description>
</valueHelp>
<valueHelp>
<format>local4</format>
<description>Local facility 4</description>
</valueHelp>
<valueHelp>
<format>local5</format>
<description>Local facility 5</description>
</valueHelp>
<valueHelp>
<format>local6</format>
<description>Local facility 6</description>
</valueHelp>
<valueHelp>
<format>local7</format>
<description>Local facility 7</description>
</valueHelp>
</properties>
<children>
<leafNode name="level">
<properties>
<help>Logging level</help>
<completionHelp>
<list>emerg alert crit err warning notice info debug all</list>
</completionHelp>
<constraint>
<regex>^(emerg|alert|crit|err|warning|notice|info|debug|all)$</regex>
</constraint>
<constraintErrorMessage>Invalid loglevel</constraintErrorMessage>
<valueHelp>
<format>emerg</format>
<description>Emergency messages</description>
</valueHelp>
<valueHelp>
<format>alert</format>
<description>Urgent messages</description>
</valueHelp>
<valueHelp>
<format>crit</format>
<description>Critical messages</description>
</valueHelp>
<valueHelp>
<format>err</format>
<description>Error messages</description>
</valueHelp>
<valueHelp>
<format>warning</format>
<description>Warning messages</description>
</valueHelp>
<valueHelp>
<format>notice</format>
<description>Messages for further investigation</description>
</valueHelp>
<valueHelp>
<format>info</format>
<description>Informational messages</description>
</valueHelp>
<valueHelp>
<format>debug</format>
<description>Debug messages</description>
</valueHelp>
<valueHelp>
<format>all</format>
<description>Log everything</description>
</valueHelp>
</properties>
</leafNode>
</children>
</tagNode>
</children>
</tagNode>
<node name="console">
<properties>
<help>logging to serial console</help>
</properties>
<children>
<tagNode name="facility">
<properties>
<help>Facility for logging</help>
<completionHelp>
<list>auth authpriv cron daemon kern lpr mail mark news protocols security syslog user uucp local0 local1 local2 local3 local4 local5 local6 local7 all</list>
</completionHelp>
<constraint>
<regex>^(auth|authpriv|cron|daemon|kern|lpr|mail|mark|news|protocols|security|syslog|user|uucp|local0|local1|local2|local3|local4|local5|local6|local7|all)$</regex>
</constraint>
<constraintErrorMessage>Invalid facility type</constraintErrorMessage>
<valueHelp>
<format>all</format>
<description>All facilities excluding "mark"</description>
</valueHelp>
<valueHelp>
<format>auth</format>
<description>Authentication and authorization</description>
</valueHelp>
<valueHelp>
<format>authpriv</format>
<description>Non-system authorization</description>
</valueHelp>
<valueHelp>
<format>cron</format>
<description>Cron daemon</description>
</valueHelp>
<valueHelp>
<format>daemon</format>
<description>System daemons</description>
</valueHelp>
<valueHelp>
<format>kern</format>
<description>Kernel</description>
</valueHelp>
<valueHelp>
<format>lpr</format>
<description>Line printer spooler</description>
</valueHelp>
<valueHelp>
<format>mail</format>
<description>Mail subsystem</description>
</valueHelp>
<valueHelp>
<format>mark</format>
<description>Timestamp</description>
</valueHelp>
<valueHelp>
<format>news</format>
<description>USENET subsystem</description>
</valueHelp>
<valueHelp>
<format>protocols</format>
<description>depricated will be set to local7</description>
</valueHelp>
<valueHelp>
<format>security</format>
<description>depricated will be set to auth</description>
</valueHelp>
<valueHelp>
<format>syslog</format>
<description>Authentication and authorization</description>
</valueHelp>
<valueHelp>
<format>user</format>
<description>Application processes</description>
</valueHelp>
<valueHelp>
<format>uucp</format>
<description>UUCP subsystem</description>
</valueHelp>
<valueHelp>
<format>local0</format>
<description>Local facility 0</description>
</valueHelp>
<valueHelp>
<format>local1</format>
<description>Local facility 1</description>
</valueHelp>
<valueHelp>
<format>local2</format>
<description>Local facility 2</description>
</valueHelp>
<valueHelp>
<format>local3</format>
<description>Local facility 3</description>
</valueHelp>
<valueHelp>
<format>local4</format>
<description>Local facility 4</description>
</valueHelp>
<valueHelp>
<format>local5</format>
<description>Local facility 5</description>
</valueHelp>
<valueHelp>
<format>local6</format>
<description>Local facility 6</description>
</valueHelp>
<valueHelp>
<format>local7</format>
<description>Local facility 7</description>
</valueHelp>
</properties>
<children>
<leafNode name="level">
<properties>
<help>Logging level</help>
<completionHelp>
<list>emerg alert crit err warning notice info debug all</list>
</completionHelp>
<constraint>
<regex>^(emerg|alert|crit|err|warning|notice|info|debug|all)$</regex>
</constraint>
<constraintErrorMessage>Invalid loglevel</constraintErrorMessage>
<valueHelp>
<format>emerg</format>
<description>Emergency messages</description>
</valueHelp>
<valueHelp>
<format>alert</format>
<description>Urgent messages</description>
</valueHelp>
<valueHelp>
<format>crit</format>
<description>Critical messages</description>
</valueHelp>
<valueHelp>
<format>err</format>
<description>Error messages</description>
</valueHelp>
<valueHelp>
<format>warning</format>
<description>Warning messages</description>
</valueHelp>
<valueHelp>
<format>notice</format>
<description>Messages for further investigation</description>
</valueHelp>
<valueHelp>
<format>info</format>
<description>Informational messages</description>
</valueHelp>
<valueHelp>
<format>debug</format>
<description>Debug messages</description>
</valueHelp>
<valueHelp>
<format>all</format>
<description>Log everything</description>
</valueHelp>
</properties>
</leafNode>
</children>
</tagNode>
</children>
</node>
+ #include <include/interface/vrf.xml.i>
</children>
</node>
</children>
</node>
</interfaceDefinition>
diff --git a/src/conf_mode/system-syslog.py b/src/conf_mode/system-syslog.py
index 3d8a51cd8..030192ec2 100755
--- a/src/conf_mode/system-syslog.py
+++ b/src/conf_mode/system-syslog.py
@@ -1,268 +1,283 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2018-2020 VyOS maintainers and contributors
+# Copyright (C) 2018-2023 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
# published by the Free Software Foundation.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import re
from sys import exit
from vyos.config import Config
+from vyos.configdict import is_node_changed
+from vyos.configverify import verify_vrf
from vyos import ConfigError
from vyos.util import run
+from vyos.util import call
from vyos.template import render
from vyos import airbag
airbag.enable()
def get_config(config=None):
if config:
c = config
else:
c = Config()
if not c.exists('system syslog'):
return None
c.set_level('system syslog')
config_data = {
'files': {},
- 'console': {},
- 'hosts': {},
- 'user': {}
+ 'console': {},
+ 'hosts': {},
+ 'user': {}
}
#
# /etc/rsyslog.d/vyos-rsyslog.conf
# 'set system syslog global'
#
config_data['files'].update(
{
'global': {
'log-file': '/var/log/messages',
'max-size': 262144,
'action-on-max-size': '/usr/sbin/logrotate /etc/logrotate.d/vyos-rsyslog',
'selectors': '*.notice;local7.debug',
'max-files': '5',
'preserver_fqdn': False
}
}
)
if c.exists('global marker'):
config_data['files']['global']['marker'] = True
if c.exists('global marker interval'):
config_data['files']['global'][
'marker-interval'] = c.return_value('global marker interval')
if c.exists('global facility'):
config_data['files']['global'][
'selectors'] = generate_selectors(c, 'global facility')
if c.exists('global archive size'):
config_data['files']['global']['max-size'] = int(
c.return_value('global archive size')) * 1024
if c.exists('global archive file'):
config_data['files']['global'][
'max-files'] = c.return_value('global archive file')
if c.exists('global preserve-fqdn'):
config_data['files']['global']['preserver_fqdn'] = True
#
# set system syslog file
#
-
if c.exists('file'):
filenames = c.list_nodes('file')
for filename in filenames:
config_data['files'].update(
{
filename: {
'log-file': '/var/log/user/' + filename,
'max-files': '5',
'action-on-max-size': '/usr/sbin/logrotate /etc/logrotate.d/' + filename,
'selectors': '*.err',
'max-size': 262144
}
}
)
if c.exists('file ' + filename + ' facility'):
config_data['files'][filename]['selectors'] = generate_selectors(
c, 'file ' + filename + ' facility')
if c.exists('file ' + filename + ' archive size'):
config_data['files'][filename]['max-size'] = int(
c.return_value('file ' + filename + ' archive size')) * 1024
if c.exists('file ' + filename + ' archive files'):
config_data['files'][filename]['max-files'] = c.return_value(
'file ' + filename + ' archive files')
# set system syslog console
if c.exists('console'):
config_data['console'] = {
'/dev/console': {
'selectors': '*.err'
}
}
for f in c.list_nodes('console facility'):
if c.exists('console facility ' + f + ' level'):
config_data['console'] = {
'/dev/console': {
'selectors': generate_selectors(c, 'console facility')
}
}
# set system syslog host
if c.exists('host'):
rhosts = c.list_nodes('host')
proto = 'udp'
for rhost in rhosts:
for fac in c.list_nodes('host ' + rhost + ' facility'):
if c.exists('host ' + rhost + ' facility ' + fac + ' protocol'):
proto = c.return_value(
'host ' + rhost + ' facility ' + fac + ' protocol')
else:
proto = 'udp'
config_data['hosts'].update(
{
rhost: {
'selectors': generate_selectors(c, 'host ' + rhost + ' facility'),
'proto': proto
}
}
)
if c.exists('host ' + rhost + ' port'):
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')
for usr in usrs:
config_data['user'].update(
{
usr: {
'selectors': generate_selectors(c, 'user ' + usr + ' facility')
}
}
)
+ if c.exists('vrf'):
+ config_data.update({'vrf' : c.return_value('vrf')})
+
return config_data
def generate_selectors(c, config_node):
# protocols and security are being mapped here
# for backward compatibility with old configs
# security and protocol mappings can be removed later
nodes = c.list_nodes(config_node)
selectors = ""
for node in nodes:
lvl = c.return_value(config_node + ' ' + node + ' level')
if lvl == None:
lvl = "err"
if lvl == 'all':
lvl = '*'
if node == 'all' and node != nodes[-1]:
selectors += "*." + lvl + ";"
elif node == 'all':
selectors += "*." + lvl
elif node != nodes[-1]:
if node == 'protocols':
node = 'local7'
if node == 'security':
node = 'auth'
selectors += node + "." + lvl + ";"
else:
if node == 'protocols':
node = 'local7'
if node == 'security':
node = 'auth'
selectors += node + "." + lvl
return selectors
def generate(c):
if c == None:
return None
conf = '/etc/rsyslog.d/vyos-rsyslog.conf'
render(conf, 'syslog/rsyslog.conf.tmpl', c)
# eventually write for each file its own logrotate file, since size is
# defined it shouldn't matter
conf = '/etc/logrotate.d/vyos-rsyslog'
render(conf, 'syslog/logrotate.tmpl', c)
+ conf = r'/etc/systemd/system/rsyslog.service.d/override.conf'
+ render(conf, 'syslog/override.conf.tmpl', c)
+
+ # Reload systemd manager configuration
+ call('systemctl daemon-reload')
def verify(c):
if c == None:
return None
# may be obsolete
# /etc/rsyslog.conf is generated somewhere and copied over the original (exists in /opt/vyatta/etc/rsyslog.conf)
# it interferes with the global logging, to make sure we are using a single base, template is enforced here
#
if not os.path.islink('/etc/rsyslog.conf'):
os.remove('/etc/rsyslog.conf')
- os.symlink(
- '/usr/share/vyos/templates/rsyslog/rsyslog.conf', '/etc/rsyslog.conf')
+ os.symlink('/usr/share/vyos/templates/rsyslog/rsyslog.conf',
+ '/etc/rsyslog.conf')
+
+
+ verify_vrf(c)
# /var/log/vyos-rsyslog were the old files, we may want to clean those up, but currently there
# is a chance that someone still needs it, so I don't automatically remove
# them
#
if c == None:
return None
fac = [
'*', 'auth', 'authpriv', 'cron', 'daemon', 'kern', 'lpr', 'mail', 'mark', 'news', 'protocols', 'security',
'syslog', 'user', 'uucp', 'local0', 'local1', 'local2', 'local3', 'local4', 'local5', 'local6', 'local7']
lvl = ['emerg', 'alert', 'crit', 'err',
'warning', 'notice', 'info', 'debug', '*']
for conf in c:
if c[conf]:
+ if conf == 'vrf':
+ continue
for item in c[conf]:
for s in c[conf][item]['selectors'].split(";"):
f = re.sub("\..*$", "", s)
if f not in fac:
raise ConfigError(
'Invalid facility ' + s + ' set in ' + conf + ' ' + item)
l = re.sub("^.+\.", "", s)
if l not in lvl:
raise ConfigError(
'Invalid logging level ' + s + ' set in ' + conf + ' ' + item)
def apply(c):
if not c:
return run('systemctl stop syslog.service')
return run('systemctl restart syslog.service')
if __name__ == '__main__':
try:
c = get_config()
verify(c)
generate(c)
apply(c)
except ConfigError as e:
print(e)
exit(1)

File Metadata

Mime Type
text/x-diff
Expires
Fri, Nov 6, 8:34 AM (1 d, 23 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4613976
Default Alt Text
(53 KB)

Event Timeline