diff --git a/interface-definitions/nat.xml.in b/interface-definitions/nat.xml.in index 0a639bd808..73a7481379 100644 --- a/interface-definitions/nat.xml.in +++ b/interface-definitions/nat.xml.in @@ -141,6 +141,7 @@ #include + #include Translation address or prefix diff --git a/op-mode-definitions/show-log.xml.in b/op-mode-definitions/show-log.xml.in index 78c03f5113..c1e441e402 100644 --- a/op-mode-definitions/show-log.xml.in +++ b/op-mode-definitions/show-log.xml.in @@ -464,12 +464,56 @@ journalctl --no-hostname --boot --unit lldpd.service - + Show log for Network Address Translation (NAT) - egrep -i "kernel:.*\[NAT-[A-Z]{3,}-[0-9]+(-MASQ)?\]" $(find /var/log -maxdepth 1 -type f -name messages\* | sort -t. -k2nr) - + + + + Show NAT destination log + + journalctl --no-hostname --boot -k | egrep "\[DST-NAT-[0-9]+\]" + + + + Show NAT destination log for specified rule + + journalctl --no-hostname --boot -k | egrep "\[DST-NAT-$6\]" + + + + + + Show NAT source log + + journalctl --no-hostname --boot -k | egrep "\[SRC-NAT-[0-9]+(-MASQ)?\]""" + + + + Show NAT source log for specified rule + + journalctl --no-hostname --boot -k | egrep "\[SRC-NAT-$6(-MASQ)?\]" + + + + + + Show NAT static log + + journalctl --no-hostname --boot -k | egrep "\[STATIC-(SRC|DST)-NAT-[0-9]+\]" + + + + Show NAT static log for specified rule + + journalctl --no-hostname --boot -k | egrep "\[STATIC-(SRC|DST)-NAT-$6\]" + + + + + journalctl --no-hostname --boot -k | egrep "\[(STATIC-)?(DST|SRC)-NAT-[0-9]+(-MASQ)?\]" + Show log for Neighbor Discovery Protocol (NDP) Proxy diff --git a/python/vyos/nat.py b/python/vyos/nat.py index 2ada29add1..e545487887 100644 --- a/python/vyos/nat.py +++ b/python/vyos/nat.py @@ -300,12 +300,12 @@ def parse_nat_static_rule(rule_conf, rule_id, nat_type): output.append('counter') - if translation_str: - output.append(translation_str) - if 'log' in rule_conf: output.append(f'log prefix "[{log_prefix}{log_suffix}]"') + if translation_str: + output.append(translation_str) + output.append(f'comment "{log_prefix}"') return " ".join(output)