mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-03-01 11:39:36 +00:00
log-forward: use comparison for ids
This was introduced with RouterOS 7.22beta1.
This commit is contained in:
parent
c9f0c5a9f2
commit
44663f0c38
1 changed files with 7 additions and 8 deletions
|
|
@ -24,7 +24,6 @@
|
|||
:global LogForwardRateLimit;
|
||||
|
||||
:global EitherOr;
|
||||
:global HexToNum;
|
||||
:global IfThenElse;
|
||||
:global LogForwardFilterLogForwarding;
|
||||
:global LogPrint;
|
||||
|
|
@ -38,6 +37,9 @@
|
|||
:error false;
|
||||
}
|
||||
|
||||
# LogForwardLast is not initialized, by intention: we want
|
||||
# to catch *0 on first invocation!
|
||||
|
||||
:if ([ :typeof $LogForwardRateLimit ] = "nothing") do={
|
||||
:set LogForwardRateLimit 0;
|
||||
}
|
||||
|
|
@ -51,7 +53,6 @@
|
|||
|
||||
:local Count 0;
|
||||
:local Duplicates false;
|
||||
:local Last [ $IfThenElse ([ :len $LogForwardLast ] > 0) [ $HexToNum $LogForwardLast ] -1 ];
|
||||
:local Messages "";
|
||||
:local Warning false;
|
||||
:local MessageVal;
|
||||
|
|
@ -63,14 +64,13 @@
|
|||
:set LogForwardIncludeMessage [ $EitherOr $LogForwardIncludeMessage [] ];
|
||||
|
||||
:local LogForwardFilterLogForwardingCached [ $EitherOr [ $LogForwardFilterLogForwarding ] ("\$^") ];
|
||||
:foreach Message in=[ /log/find where (!(message="") and \
|
||||
!(message~$LogForwardFilterLogForwardingCached) and \
|
||||
!(topics~$LogForwardFilter) and !(message~$LogForwardFilterMessage)) or \
|
||||
topics~$LogForwardInclude or message~$LogForwardIncludeMessage ] do={
|
||||
:foreach Message in=[ /log/find where .id>$LogForwardLast and \
|
||||
((!(message="") and !(message~$LogForwardFilterLogForwardingCached) and \
|
||||
!(topics~$LogForwardFilter) and !(message~$LogForwardFilterMessage)) or \
|
||||
topics~$LogForwardInclude or message~$LogForwardIncludeMessage) ] do={
|
||||
:set MessageVal [ /log/get $Message ];
|
||||
:local Bullet "information";
|
||||
|
||||
:if ($Last < [ $HexToNum ($MessageVal->".id") ]) do={
|
||||
:local DupCount ($MessageDups->($MessageVal->"message"));
|
||||
:if ($MessageVal->"topics" ~ "(warning)") do={
|
||||
:set Warning true;
|
||||
|
|
@ -88,7 +88,6 @@
|
|||
}
|
||||
:set ($MessageDups->($MessageVal->"message")) ($DupCount + 1);
|
||||
:set Count ($Count + 1);
|
||||
}
|
||||
}
|
||||
|
||||
:if ($Count > 0) do={
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue