Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T6641: Add vyos-network-event-logger Service #4216

Open
wants to merge 1 commit into
base: current
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions interface-definitions/include/netlink/log-level.xml.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!-- include start from netlink/log-level.xml.i -->
<leafNode name="log-level">
<properties>
<help>Set log-level</help>
<completionHelp>
<list>info debug</list>
</completionHelp>
<valueHelp>
<format>info</format>
<description>Info log level</description>
</valueHelp>
<valueHelp>
<format>debug</format>
<description>Debug log level</description>
</valueHelp>
<constraint>
<regex>(info|debug)</regex>
</constraint>
</properties>
</leafNode>
<!-- include end -->
15 changes: 15 additions & 0 deletions interface-definitions/include/netlink/queue-size.xml.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!-- include start from netlink/queue-size.xml.i -->
<leafNode name="queue-size">
<properties>
<help>Internal message queue size</help>
<valueHelp>
<format>u32:100-2147483647</format>
<description>Queue size</description>
</valueHelp>
<constraint>
<validator name="numeric" argument="--range 1-2147483647"/>
</constraint>
<constraintErrorMessage>Queue size must be between 100 and 2147483647</constraintErrorMessage>
</properties>
</leafNode>
<!-- include end -->
61 changes: 61 additions & 0 deletions interface-definitions/service_monitoring_network_event.xml.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0"?>
<interfaceDefinition>
<node name="service">
<children>
<node name="monitoring">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably make a skeleton node for monitoring and include everything else into it, although it's a topic for a different PR.

<properties>
<help>Monitoring services</help>
</properties>
<children>
<node name="network-event" owner="${vyos_conf_scripts_dir}/service_monitoring_network_event.py">
<properties>
<help>Network event logger</help>
<priority>1280</priority>
</properties>
<children>
<node name="event">
<properties>
<help>Network event type</help>
</properties>
<children>
<leafNode name="route">
<properties>
<help>Log routing table update events</help>
<valueless/>
</properties>
</leafNode>
<leafNode name="link">
<properties>
<help>Log link status change events</help>
<valueless/>
</properties>
</leafNode>
<leafNode name="addr">
<properties>
<help>Log address assignment and removal events</help>
<valueless/>
</properties>
</leafNode>
<leafNode name="neigh">
<properties>
<help>Log neighbor (ARP/ND) table update events</help>
<valueless/>
</properties>
</leafNode>
<leafNode name="rule">
<properties>
<help>Log policy routing rule change events</help>
<valueless/>
</properties>
</leafNode>
</children>
</node>
#include <include/netlink/queue-size.xml.i>
#include <include/netlink/log-level.xml.i>
</children>
</node>
</children>
</node>
</children>
</node>
</interfaceDefinition>
34 changes: 2 additions & 32 deletions interface-definitions/system_conntrack.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -263,38 +263,8 @@
<valueless/>
</properties>
</leafNode>
<leafNode name="queue-size">
<properties>
<help>Internal message queue size</help>
<valueHelp>
<format>u32:100-999999</format>
<description>Queue size</description>
</valueHelp>
<constraint>
<validator name="numeric" argument="--range 1-999999"/>
</constraint>
<constraintErrorMessage>Queue size must be between 100 and 999999</constraintErrorMessage>
</properties>
</leafNode>
<leafNode name="log-level">
<properties>
<help>Set log-level. Log must be enable.</help>
<completionHelp>
<list>info debug</list>
</completionHelp>
<valueHelp>
<format>info</format>
<description>Info log level</description>
</valueHelp>
<valueHelp>
<format>debug</format>
<description>Debug log level</description>
</valueHelp>
<constraint>
<regex>(info|debug)</regex>
</constraint>
</properties>
</leafNode>
#include <include/netlink/queue-size.xml.i>
#include <include/netlink/log-level.xml.i>
</children>
</node>
<node name="modules">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- included start from network-event-type-interface.xml.i -->
<tagNode name="interface">
<properties>
<help>Show log for specific interface</help>
<completionHelp>
<script>${vyos_completion_dir}/list_interfaces</script>
</completionHelp>
</properties>
<command>journalctl --no-hostname --boot --unit vyos-network-event-logger.service | grep "$(echo "\[$4\]" | tr '[:lower:]' '[:upper:]')" | grep "\b$6\b"</command>
</tagNode>
<!-- included end -->
40 changes: 40 additions & 0 deletions op-mode-definitions/include/show-interface-type-event-log.xml.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!-- included start from show-interface-type-event-log.xml.i -->
<node name="event-log">
<properties>
<help>Show network interface change event log</help>
</properties>
<command>journalctl --no-hostname --boot --unit vyos-network-event-logger.service --grep "\b$4\b"</command>
<children>
<leafNode name="route">
<properties>
<help>Show log for route events</help>
</properties>
<command>journalctl --no-hostname --boot --unit vyos-network-event-logger.service --grep "\b$4\b" | grep -i "\[$6\]"</command>
</leafNode>
<leafNode name="link">
<properties>
<help>Show log for network link events</help>
</properties>
<command>journalctl --no-hostname --boot --unit vyos-network-event-logger.service --grep "\b$4\b" | grep -i "\[$6\]"</command>
</leafNode>
<leafNode name="addr">
<properties>
<help>Show log for network address events</help>
</properties>
<command>journalctl --no-hostname --boot --unit vyos-network-event-logger.service --grep "\b$4\b" | grep -i "\[$6\]"</command>
</leafNode>
<leafNode name="neigh">
<properties>
<help>Show log for neighbor table events</help>
</properties>
<command>journalctl --no-hostname --boot --unit vyos-network-event-logger.service --grep "\b$4\b" | grep -i "\[$6\]"</command>
</leafNode>
<leafNode name="rule">
<properties>
<help>Show log for PBR rule change events</help>
</properties>
<command>journalctl --no-hostname --boot --unit vyos-network-event-logger.service --grep "\b$4\b" | grep -i "\[$6\]"</command>
</leafNode>
</children>
</node>
<!-- included end -->
1 change: 1 addition & 0 deletions op-mode-definitions/show-interfaces-bonding.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
</leafNode>
</children>
</tagNode>
#include <include/show-interface-type-event-log.xml.i>
</children>
</tagNode>
<node name="bonding">
Expand Down
1 change: 1 addition & 0 deletions op-mode-definitions/show-interfaces-bridge.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
</properties>
<command>${vyos_op_scripts_dir}/interfaces.py show_summary --intf-name="$4" --intf-type=bridge</command>
</leafNode>
#include <include/show-interface-type-event-log.xml.i>
</children>
</tagNode>
<node name="bridge">
Expand Down
1 change: 1 addition & 0 deletions op-mode-definitions/show-interfaces-dummy.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
</properties>
<command>${vyos_op_scripts_dir}/interfaces.py show_summary --intf-name="$4" --intf-type=dummy</command>
</leafNode>
#include <include/show-interface-type-event-log.xml.i>
</children>
</tagNode>
<node name="dummy">
Expand Down
1 change: 1 addition & 0 deletions op-mode-definitions/show-interfaces-ethernet.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
</leafNode>
</children>
</tagNode>
#include <include/show-interface-type-event-log.xml.i>
</children>
</tagNode>
<node name="ethernet">
Expand Down
1 change: 1 addition & 0 deletions op-mode-definitions/show-interfaces-geneve.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
</properties>
<command>${vyos_op_scripts_dir}/interfaces.py show_summary --intf-name="$4" --intf-type=geneve</command>
</leafNode>
#include <include/show-interface-type-event-log.xml.i>
</children>
</tagNode>
<node name="geneve">
Expand Down
1 change: 1 addition & 0 deletions op-mode-definitions/show-interfaces-input.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
</properties>
<command>${vyos_op_scripts_dir}/interfaces.py show_summary --intf-name="$4" --intf-type=input</command>
</leafNode>
#include <include/show-interface-type-event-log.xml.i>
</children>
</tagNode>
<node name="input">
Expand Down
1 change: 1 addition & 0 deletions op-mode-definitions/show-interfaces-l2tpv3.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
</properties>
<command>${vyos_op_scripts_dir}/interfaces.py show_summary --intf-name="$4" --intf-type=l2tpv3</command>
</leafNode>
#include <include/show-interface-type-event-log.xml.i>
</children>
</tagNode>
<node name="l2tpv3">
Expand Down
1 change: 1 addition & 0 deletions op-mode-definitions/show-interfaces-loopback.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
</properties>
<command>${vyos_op_scripts_dir}/interfaces.py show_summary --intf-name="$4" --intf-type=loopback</command>
</leafNode>
#include <include/show-interface-type-event-log.xml.i>
</children>
</tagNode>
<node name="loopback">
Expand Down
3 changes: 3 additions & 0 deletions op-mode-definitions/show-interfaces-macsec.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
</completionHelp>
</properties>
<command>ip macsec show $4</command>
<children>
#include <include/show-interface-type-event-log.xml.i>
</children>
</tagNode>
</children>
</node>
Expand Down
1 change: 1 addition & 0 deletions op-mode-definitions/show-interfaces-pppoe.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
</properties>
<command>if [ -d "/sys/class/net/$4" ]; then /usr/sbin/pppstats "$4"; fi</command>
</leafNode>
#include <include/show-interface-type-event-log.xml.i>
</children>
</tagNode>
<node name="pppoe">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
</properties>
<command>${vyos_op_scripts_dir}/interfaces.py show_summary --intf-name="$4" --intf-type=pseudo-ethernet</command>
</leafNode>
#include <include/show-interface-type-event-log.xml.i>
</children>
</tagNode>
<node name="pseudo-ethernet">
Expand Down
1 change: 1 addition & 0 deletions op-mode-definitions/show-interfaces-sstpc.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
</properties>
<command>if [ -d "/sys/class/net/$4" ]; then /usr/sbin/pppstats "$4"; fi</command>
</leafNode>
#include <include/show-interface-type-event-log.xml.i>
</children>
</tagNode>
<node name="sstpc">
Expand Down
1 change: 1 addition & 0 deletions op-mode-definitions/show-interfaces-tunnel.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
</properties>
<command>${vyos_op_scripts_dir}/interfaces.py show_summary --intf-name="$4" --intf-type=tunnel</command>
</leafNode>
#include <include/show-interface-type-event-log.xml.i>
</children>
</tagNode>
<node name="tunnel">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
</properties>
<command>${vyos_op_scripts_dir}/interfaces.py show_summary --intf-name="$4" --intf-type=virtual-ethernet</command>
</leafNode>
#include <include/show-interface-type-event-log.xml.i>
</children>
</tagNode>
<node name="virtual-ethernet">
Expand Down
1 change: 1 addition & 0 deletions op-mode-definitions/show-interfaces-vti.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
</properties>
<command>${vyos_op_scripts_dir}/interfaces.py show_summary --intf-name="$4" --intf-type=vti</command>
</leafNode>
#include <include/show-interface-type-event-log.xml.i>
</children>
</tagNode>
<node name="vti">
Expand Down
1 change: 1 addition & 0 deletions op-mode-definitions/show-interfaces-vxlan.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
</properties>
<command>${vyos_op_scripts_dir}/interfaces.py show_summary --intf-name="$4" --intf-type=vxlan</command>
</leafNode>
#include <include/show-interface-type-event-log.xml.i>
</children>
</tagNode>
<node name="vxlan">
Expand Down
1 change: 1 addition & 0 deletions op-mode-definitions/show-interfaces-wireguard.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
</properties>
<command>sudo ${vyos_op_scripts_dir}/interfaces_wireguard.py show_summary --intf-name="$4"</command>
</leafNode>
#include <include/show-interface-type-event-log.xml.i>
</children>
</tagNode>
<node name="wireguard">
Expand Down
1 change: 1 addition & 0 deletions op-mode-definitions/show-interfaces-wireless.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
</leafNode>
</children>
</tagNode>
#include <include/show-interface-type-event-log.xml.i>
</children>
</tagNode>
</children>
Expand Down
1 change: 1 addition & 0 deletions op-mode-definitions/show-interfaces-wwan.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
</properties>
<command>echo not implemented</command>
</leafNode>
#include <include/show-interface-type-event-log.xml.i>
</children>
</tagNode>
<node name="wwan">
Expand Down
Loading
Loading