mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-14 12:04:29 +02:00
log-forward: filter e-mail error on log forwarding in script...
... and update the filter in global configuration.
This commit is contained in:
parent
d00f18dc8c
commit
baa096fe03
2 changed files with 12 additions and 4 deletions
|
@ -55,9 +55,11 @@
|
||||||
|
|
||||||
# This defines a filter on log topics not to be forwarded.
|
# This defines a filter on log topics not to be forwarded.
|
||||||
:global LogForwardFilter "(debug|info)";
|
:global LogForwardFilter "(debug|info)";
|
||||||
# ... and the same for log message text.
|
# ... and the same for log message text. Regular expressions are supported.
|
||||||
:global LogForwardFilterMessage "(^\$|^Error sending e-mail .* Log Forwarding)";
|
# Do *NOT* set an empty string - that will filter everything!
|
||||||
#:global LogForwardFilterMessage "(^\$|message text|...)";
|
:global LogForwardFilterMessage [];
|
||||||
|
#:global LogForwardFilterMessage "message text";
|
||||||
|
#:global LogForwardFilterMessage "(message text|another text|...)";
|
||||||
|
|
||||||
# Specify an address to enable auto update to version assumed safe.
|
# Specify an address to enable auto update to version assumed safe.
|
||||||
# The configured channel (bugfix, current, release-candidate) is appended.
|
# The configured channel (bugfix, current, release-candidate) is appended.
|
||||||
|
|
|
@ -17,8 +17,10 @@
|
||||||
:global LogForwardRateLimit;
|
:global LogForwardRateLimit;
|
||||||
:global NotificationsWithSymbols;
|
:global NotificationsWithSymbols;
|
||||||
|
|
||||||
|
:global CharacterReplace;
|
||||||
:global IfThenElse;
|
:global IfThenElse;
|
||||||
:global LogPrintExit2;
|
:global LogPrintExit2;
|
||||||
|
:global QuotedPrintable;
|
||||||
:global ScriptLock;
|
:global ScriptLock;
|
||||||
:global SendNotification;
|
:global SendNotification;
|
||||||
:global SymbolForNotification;
|
:global SymbolForNotification;
|
||||||
|
@ -43,7 +45,11 @@ $WaitFullyConnected;
|
||||||
:local MessageVal;
|
:local MessageVal;
|
||||||
:local MessageDups [ :toarray "" ];
|
:local MessageDups [ :toarray "" ];
|
||||||
|
|
||||||
:foreach Message in=[ / log find where !(topics~$LogForwardFilter) !(message~$LogForwardFilterMessage) ] do={
|
:local LogForwardFilterLogForwarding [ $CharacterReplace ("^Error sending e-mail <" . \
|
||||||
|
[ $QuotedPrintable ("\\[" . $Identity . "\\] " . [ $SymbolForNotification "warning-sign" ] . \
|
||||||
|
"Log Forwarding") ] . ">:") ("\?") ("\\\?") ];
|
||||||
|
:foreach Message in=[ / log find where !(topics~$LogForwardFilter) !(message="") \
|
||||||
|
!(message~$LogForwardFilterLogForwarding) !(message~$LogForwardFilterMessage) ] do={
|
||||||
:set MessageVal [ / log get $Message ];
|
:set MessageVal [ / log get $Message ];
|
||||||
|
|
||||||
:if ($LogForwardLast = ($MessageVal->".id")) do={
|
:if ($LogForwardLast = ($MessageVal->".id")) do={
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue