log-forward: implement reverse logic to include messages...

... even if a filter matches to exclude them. Let's have an example:

:global LogForwardFilter "(debug|info)";
:global LogForwardInclude "account";

This will forward everything about topic *account* (login, logout,
failed login, ...) - even with topic *info*.
This commit is contained in:
Christian Hesse 2021-06-09 14:32:52 +02:00
parent d5f43aa26d
commit de61c14c60
6 changed files with 20 additions and 7 deletions

View file

@ -13,6 +13,8 @@
:global Identity;
:global LogForwardFilter;
:global LogForwardFilterMessage;
:global LogForwardInclude;
:global LogForwardIncludeMessage;
:global LogForwardLast;
:global LogForwardRateLimit;
:global NotificationsWithSymbols;
@ -48,8 +50,9 @@ $WaitFullyConnected;
:local LogForwardFilterLogForwarding ("^" . [ $EscapeForRegEx ("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={
:foreach Message in=[ / log find where (!(message="") and !(message~$LogForwardFilterLogForwarding) and \
!(topics~$LogForwardFilter) and !(message~$LogForwardFilterMessage)) or \
topics~$LogForwardInclude or message~$LogForwardIncludeMessage ] do={
:set MessageVal [ / log get $Message ];
:if ($LogForwardLast = ($MessageVal->".id")) do={