-
Notifications
You must be signed in to change notification settings - Fork 347
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
base: current
Are you sure you want to change the base?
Conversation
👍 |
As mentioned on Slack, this should be rebased over current and pushed to sync with the changes in A local build of this PR confirms a successful build and smoketests. |
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.
CI integration ❌ failed! Details
|
Is there any downside not enabling this service by default? |
at least, you must remember to turn it on to analyze some situations and reproduce these? otherwise logs will not stored. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a bunch of suggestions for improvement.
<properties> | ||
<help>Show interface network event log</help> | ||
</properties> | ||
<command>journalctl --no-hostname --boot --unit vyos-network-event-logger.service | grep "\b$4\b"</command> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
journalctl
has a built-in --grep=
option that supports PCRE, so I think there is no need to use an external filter here. The built-in will be faster and will preserve coloring, etc.
<properties> | ||
<help>Show log for route network events</help> | ||
</properties> | ||
<command>journalctl --no-hostname --boot --unit vyos-network-event-logger.service | grep "$(echo "\[$6\]" | tr '[:lower:]' '[:upper:]')" | grep "\b$4\b"</command> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The journalctl command is duplicated a lot here. Should we make it a script?
I'm also not convinced about the value of the tr
call here.
<!-- included start from show-nht.xml.i --> | ||
<node name="event-log"> | ||
<properties> | ||
<help>Show interface network event log</help> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<help>Show interface network event log</help> | |
<help>Show network interface change event log</help> |
<interfaceDefinition> | ||
<node name="service"> | ||
<children> | ||
<node name="monitoring"> |
There was a problem hiding this comment.
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.
logger.setLevel(logging.INFO) | ||
|
||
|
||
# https://github.com/torvalds/linux/blob/adc218676eef25575469234709c2d87185ca223a/include/uapi/linux/neighbour.h#L46 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we move the constants to a separate module? There may be more places in the future where they might be useful for handling netlink events.
</leafNode> | ||
<leafNode name="rule"> | ||
<properties> | ||
<help>Show log for rule network events</help> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<help>Show log for rule network events</help> | |
<help>Show log for PBR rule change events</help> |
</tagNode> | ||
<node name="route"> | ||
<properties> | ||
<help>Show log for route network events</help> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<help>Show log for route network events</help> | |
<help>Show log for route events</help> |
</node> | ||
<node name="link"> | ||
<properties> | ||
<help>Show log for link network events</help> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<help>Show log for link network events</help> | |
<help>Show log for network link events</help> |
</node> | ||
<node name="addr"> | ||
<properties> | ||
<help>Show log for addr network events</help> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<help>Show log for addr network events</help> | |
<help>Show log for network address events</help> |
</node> | ||
<node name="neigh"> | ||
<properties> | ||
<help>Show log for neigh network events</help> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<help>Show log for neigh network events</help> | |
<help>Show log for neighbor table events</help> |
Another reason for having this running always in the background: From FRR
|
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.Change Summary
Types of changes
Related Task(s)
Related PR(s)
Component(s) name
Proposed changes
log examples:
How to test
To check the correct parsing you can use logs from
ip monitor label
configure network-event logger to listen events:
you can use IP utils to manipulate the interface and check logs or use some
set interface *
commands e.g.Smoketest result
Checklist: