aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2022-06-02 11:05:30 +0200
committerGravatar Christian Hesse <mail@eworm.de>2022-06-02 11:14:36 +0200
commitf0f05be8a9663fab7f1fcdf0931465654a77d9bd (patch)
treec7fc064b5177eb2fde2f0cb624620ce9cae712d7
parent09d88ad91c62bd00a24ea75d41d340e5bcc2d8b8 (diff)
log-forward: inform about rate limit in notification
-rw-r--r--log-forward12
1 files changed, 7 insertions, 5 deletions
diff --git a/log-forward b/log-forward
index 55df2dc..6ccf39c 100644
--- a/log-forward
+++ b/log-forward
@@ -74,15 +74,17 @@ $ScriptLock $0;
}
:if ($Count > 0) do={
+ :set LogForwardRateLimit ($LogForwardRateLimit + 10);
+
$SendNotification2 ({ origin=$0; \
subject=([ $SymbolForNotification [ $IfThenElse ($Warning = true) "warning-sign" "memo" ] ] . \
"Log Forwarding"); \
- message=("The log on " . $Identity . " contains " . [ $IfThenElse ($Count = 1) \
- "this message" ("these " . $Count . " messages") ] . " after " . \
- [ /system/resource/get uptime ] . " uptime." . [ $IfThenElse ($Duplicates = true) \
- (" Multi-repeated messages have been skipped.") ] . "\n" . $Messages) });
+ message=("The log on " . $Identity . " contains " . [ $IfThenElse ($Count = 1) "this message" \
+ ("these " . $Count . " messages") ] . " after " . [ /system/resource/get uptime ] . " uptime." . \
+ [ $IfThenElse ($Duplicates = true) (" Multi-repeated messages have been skipped.") ] . \
+ [ $IfThenElse ($LogForwardRateLimit > 30) ("\nRate limit in action, delaying forwarding.") ] . \
+ "\n" . $Messages) });
- :set LogForwardRateLimit ($LogForwardRateLimit + 10);
:set LogForwardLast ($MessageVal->".id");
} else={
:if ($LogForwardRateLimit > 0) do={