aboutsummaryrefslogtreecommitdiffstats
path: root/log-forward.rsc
diff options
context:
space:
mode:
Diffstat (limited to 'log-forward.rsc')
-rw-r--r--log-forward.rsc20
1 files changed, 15 insertions, 5 deletions
diff --git a/log-forward.rsc b/log-forward.rsc
index e0d8f35..afeb3f2 100644
--- a/log-forward.rsc
+++ b/log-forward.rsc
@@ -1,16 +1,17 @@
#!rsc by RouterOS
# RouterOS script: log-forward
-# Copyright (c) 2020-2024 Christian Hesse <mail@eworm.de>
-# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
+# Copyright (c) 2020-2025 Christian Hesse <mail@eworm.de>
+# https://rsc.eworm.de/COPYING.md
#
-# requires RouterOS, version=7.14
+# requires RouterOS, version=7.15
#
# forward log messages via notification
-# https://git.eworm.de/cgit/routeros-scripts/about/doc/log-forward.md
+# https://rsc.eworm.de/doc/log-forward.md
:global GlobalFunctionsReady;
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
+:local ExitOK false;
:do {
:local ScriptName [ :jobname ];
@@ -33,6 +34,7 @@
:global SymbolForNotification;
:if ([ $ScriptLock $ScriptName ] = false) do={
+ :set ExitOK true;
:error false;
}
@@ -43,6 +45,7 @@
:if ($LogForwardRateLimit > 30) do={
:set LogForwardRateLimit ($LogForwardRateLimit - 1);
$LogPrint info $ScriptName ("Rate limit in action, not forwarding logs, if any!");
+ :set ExitOK true;
:error false;
}
@@ -54,6 +57,11 @@
:local MessageVal;
:local MessageDups ({});
+ :set LogForwardFilter [ $EitherOr $LogForwardFilter [] ];
+ :set LogForwardFilterMessage [ $EitherOr $LogForwardFilterMessage [] ];
+ :set LogForwardInclude [ $EitherOr $LogForwardInclude [] ];
+ :set LogForwardIncludeMessage [ $EitherOr $LogForwardIncludeMessage [] ];
+
:local LogForwardFilterLogForwardingCached [ $EitherOr [ $LogForwardFilterLogForwarding ] ("\$^") ];
:foreach Message in=[ /log/find where (!(message="") and \
!(message~$LogForwardFilterLogForwardingCached) and \
@@ -100,4 +108,6 @@
:local LogAll [ /log/find ];
:set LogForwardLast ($LogAll->([ :len $LogAll ] - 1) );
-} on-error={ }
+} on-error={
+ :global ExitError; $ExitError $ExitOK [ :jobname ];
+}