summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/templates/rsyslog/rsyslog.conf.j24
-rw-r--r--interface-definitions/system_syslog.xml.in1
-rwxr-xr-xsrc/conf_mode/system_syslog.py7
3 files changed, 12 insertions, 0 deletions
diff --git a/data/templates/rsyslog/rsyslog.conf.j2 b/data/templates/rsyslog/rsyslog.conf.j2
index efb23ca7d..779ae8d04 100644
--- a/data/templates/rsyslog/rsyslog.conf.j2
+++ b/data/templates/rsyslog/rsyslog.conf.j2
@@ -113,6 +113,10 @@ if prifilt("{{ tmp | join(',') }}") then {
template="SyslogProtocol23Format"
{% endif %}
TCP_Framing="{{ 'octed-counted' if remote_options.format.octet_counted is vyos_defined else 'traditional' }}"
+{% if source_address is vyos_defined %}
+ # Sender IP address
+ Address="{{ source_address }}"
+{% endif %}
{% if vrf is vyos_defined %}
Device="{{ vrf }}"
{% endif %}
diff --git a/interface-definitions/system_syslog.xml.in b/interface-definitions/system_syslog.xml.in
index acc7b4747..f47a95f09 100644
--- a/interface-definitions/system_syslog.xml.in
+++ b/interface-definitions/system_syslog.xml.in
@@ -100,6 +100,7 @@
#include <include/syslog-facility.xml.i>
</children>
</node>
+ #include <include/source-address-ipv4-ipv6.xml.i>
#include <include/interface/vrf.xml.i>
</children>
</node>
diff --git a/src/conf_mode/system_syslog.py b/src/conf_mode/system_syslog.py
index 78840a5f5..ce806a540 100755
--- a/src/conf_mode/system_syslog.py
+++ b/src/conf_mode/system_syslog.py
@@ -78,6 +78,13 @@ def verify(syslog):
verify_vrf(syslog)
+ if 'source_address' in syslog:
+ syslog_vrf = None
+ if 'vrf' in syslog:
+ syslog_vrf = syslog['vrf']
+ if not is_addr_assigned(syslog['source_address'], syslog_vrf):
+ raise ConfigError('No interface with given address specified!')
+
def generate(syslog):
if not syslog:
if os.path.exists(rsyslog_conf):