Configuration example for 'system_notifier' plugin #72
Replies: 1 comment 2 replies
-
Would you like to help maturing it? sources are programs returning logs, they are provided to a parser. parsers are list of rules (hence the [system_notifier]
# Active sources
sources = ["kernel_logs", "user_logs", "system_logs"]
# Sources
[system_notifier.source.kernel_logs]
command = "sudo journalctl -fkn"
parser = "journal"
[system_notifier.source.system_logs]
command = "sudo journalctl -fxn"
parser = "journal"
[system_notifier.source.user_logs]
command = "journalctl --user -fxn"
parser = "journal"
# Parsers
## Journal
[[system_notifier.parsers.journal]]
pattern = '.*systemd-networkd\[\d+\]: ([a-z0-9]+): Link (UP|DOWN)$'
filter = 's/.*\[\d+\]: ([a-z0-9]+): Link (UP|DOWN)/\1 is \2/'
[[system_notifier.parsers.journal]]
pattern = '.*systemd-coredump\[\d+\]:.* Process \d+ [(]([^)]+)[)] of .* dumped core\.$'
filter = 's/.*Process \d+ \(([^)]+)\) of .* dumped core./\1 dumped core/'
[[system_notifier.parsers.journal]]
pattern = '.*usb \d+-[0-9.]+: Product: (.*)'
filter = 's/.*usb \d+-[0-9.]+: Product: (.*)/USB plugged: \1/' Only the last rule works for me in this config... and I didn't try to debug my rules or code yet to understand why... the multiple messages are maybe not a bug depending on each the content of of the logs I source, but I didn't check it either... Could be something with newlines too, and the last rule don't have an explicit end-of-line character "$". |
Beta Was this translation helpful? Give feedback.
-
I've recently ran into an issue that required me to monitor my systemd logs more consistently and the
system_notifier
plugin sounded like exactly my thing.Sadly my python skills are a bit too rusty to reverse engineer the correct syntax for configuring matching rules. Plus I seem to had a problem with one of the regexes.
In all I wished there would have been a working configuration example ;-)
Beta Was this translation helpful? Give feedback.
All reactions