-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
T6641: Add vyos-network-event-logger Service
The service parses and logs network events for improved monitoring and diagnostics. Supported event types include: - `RTM_NEWROUTE`, `RTM_DELROUTE` - `RTM_NEWLINK`, `RTM_DELLINK` - `RTM_NEWADDR`, `RTM_DELADDR` - `RTM_NEWNEIGH`, `RTM_DELNEIGH`, `RTM_GETNEIGH` - `RTM_NEWRULE`, `RTM_DELRULE` Added operational mode commands for filtered log retrieval: - `show log network-event <event-type> <interface>`: Retrieve logs filtered by event type and interface. - `show interfaces <type> <name> event-log <event-type>`: Display interface-specific logs filtered by event type.
- Loading branch information
1 parent
99d0c7a
commit 937d370
Showing
39 changed files
with
2,024 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
61
interface-definitions/service_monitoring_network_event.xml.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"> | ||
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
op-mode-definitions/include/log/network-event-type-interface.xml.i
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
40
op-mode-definitions/include/show-interface-type-event-log.xml.i
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.