diff options
-rw-r--r-- | global-config | 8 | ||||
-rw-r--r-- | log-forward | 8 |
2 files changed, 12 insertions, 4 deletions
diff --git a/global-config b/global-config index f713b5c..107ef19 100644 --- a/global-config +++ b/global-config @@ -55,9 +55,11 @@ # This defines a filter on log topics not to be forwarded. :global LogForwardFilter "(debug|info)"; -# ... and the same for log message text. -:global LogForwardFilterMessage "(^\$|^Error sending e-mail .* Log Forwarding)"; -#:global LogForwardFilterMessage "(^\$|message text|...)"; +# ... and the same for log message text. Regular expressions are supported. +# Do *NOT* set an empty string - that will filter everything! +:global LogForwardFilterMessage []; +#:global LogForwardFilterMessage "message text"; +#:global LogForwardFilterMessage "(message text|another text|...)"; # Specify an address to enable auto update to version assumed safe. # The configured channel (bugfix, current, release-candidate) is appended. diff --git a/log-forward b/log-forward index 4332c2a..2866e2f 100644 --- a/log-forward +++ b/log-forward @@ -17,8 +17,10 @@ :global LogForwardRateLimit; :global NotificationsWithSymbols; +:global CharacterReplace; :global IfThenElse; :global LogPrintExit2; +:global QuotedPrintable; :global ScriptLock; :global SendNotification; :global SymbolForNotification; @@ -43,7 +45,11 @@ $WaitFullyConnected; :local MessageVal; :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 ]; :if ($LogForwardLast = ($MessageVal->".id")) do={ |