From f0f05be8a9663fab7f1fcdf0931465654a77d9bd Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 2 Jun 2022 11:05:30 +0200 Subject: log-forward: inform about rate limit in notification --- log-forward | 12 +++++++----- 1 file 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={ -- cgit v1.2.3-70-g09d2