aboutsummaryrefslogtreecommitdiffstats
path: root/log-forward
diff options
context:
space:
mode:
Diffstat (limited to 'log-forward')
-rw-r--r--log-forward15
1 files changed, 15 insertions, 0 deletions
diff --git a/log-forward b/log-forward
index 7da8a4a..27aa19c 100644
--- a/log-forward
+++ b/log-forward
@@ -10,6 +10,7 @@
:global LogForwardFilter;
:global LogForwardFilterMessage;
:global LogForwardLast;
+:global LogForwardRateLimit;
:global LogPrintExit;
:global MailServerIsUp;
@@ -20,6 +21,15 @@
$ScriptLock "log-forward";
+:if ([ :typeof $LogForwardRateLimit ] = "nothing") do={
+ :set LogForwardRateLimit 0;
+}
+
+:if ($LogForwardRateLimit > 30) do={
+ :set LogForwardRateLimit ($LogForwardRateLimit - 1);
+ $LogPrintExit info ("Rate limit in action, not forwarding logs!") true;
+}
+
$WaitFullyConnected;
:if ([ $MailServerIsUp ] = false) do={
@@ -48,5 +58,10 @@ $WaitFullyConnected;
("The log on " . $Identity . " contains these " . $Count . " messages after " . \
[ / system resource get uptime ] . " uptime.\n" . $Messages);
+ :set LogForwardRateLimit ($LogForwardRateLimit + 10);
:set LogForwardLast ($MessageVal->".id");
+} else={
+ :if ($LogForwardRateLimit > 0) do={
+ :set LogForwardRateLimit ($LogForwardRateLimit - 1);
+ }
}