mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
log-forward: add filter on log message text
This commit is contained in:
parent
c3ea555233
commit
697e32a306
6 changed files with 11 additions and 5 deletions
|
@ -31,9 +31,10 @@ Just install the script:
|
||||||
Configuration
|
Configuration
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
The configuration goes to `global-config-overlay`, there is just one parameters:
|
The configuration goes to `global-config-overlay`, these are the parameters:
|
||||||
|
|
||||||
* `LogForwardFilter`: define topics *not* to be forwarded
|
* `LogForwardFilter`: define topics *not* to be forwarded
|
||||||
|
* `LogForwardFilterMessage`: define message text *not* to be forwarded
|
||||||
|
|
||||||
Also notification settings are required for e-mail and telegram.
|
Also notification settings are required for e-mail and telegram.
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
# Make sure all configuration properties are up to date and this
|
# Make sure all configuration properties are up to date and this
|
||||||
# value is in sync with value in script 'global-functions'!
|
# value is in sync with value in script 'global-functions'!
|
||||||
:global GlobalConfigVersion 28;
|
:global GlobalConfigVersion 29;
|
||||||
|
|
||||||
# This is used for DNS and backup file.
|
# This is used for DNS and backup file.
|
||||||
:global Domain "example.com";
|
:global Domain "example.com";
|
||||||
|
@ -48,6 +48,9 @@
|
||||||
|
|
||||||
# This defines a filter on log topics not to be forwarded.
|
# This defines a filter on log topics not to be forwarded.
|
||||||
:global LogForwardFilter "(debug|info|script)";
|
:global LogForwardFilter "(debug|info|script)";
|
||||||
|
# ... and the same for log message text.
|
||||||
|
:global LogForwardFilterMessage "^\$";
|
||||||
|
#:global LogForwardFilterMessage "(^\$|message text|...)";
|
||||||
|
|
||||||
# Specify an address to enable auto update to version assumed safe.
|
# Specify an address to enable auto update to version assumed safe.
|
||||||
# The configured channel (bugfix, current, release-candidate) is appended.
|
# The configured channel (bugfix, current, release-candidate) is appended.
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
# Make sure all configuration properties are up to date and this
|
# Make sure all configuration properties are up to date and this
|
||||||
# value is in sync with value in script 'global-functions'!
|
# value is in sync with value in script 'global-functions'!
|
||||||
# Comment or remove to disable change notifications.
|
# Comment or remove to disable change notifications.
|
||||||
:global GlobalConfigVersion 28;
|
:global GlobalConfigVersion 29;
|
||||||
|
|
||||||
# Copy configuration from global-config here and modify it.
|
# Copy configuration from global-config here and modify it.
|
||||||
|
|
||||||
|
|
|
@ -32,4 +32,5 @@
|
||||||
26="Made check count threshold in 'netwatch-notify' configurable.";
|
26="Made check count threshold in 'netwatch-notify' configurable.";
|
||||||
27="Added queue for Telegram notifications to resend later on error.";
|
27="Added queue for Telegram notifications to resend later on error.";
|
||||||
28="Made 'dhcp-to-dns' act on all bound leases, not just dynamic ones.";
|
28="Made 'dhcp-to-dns' act on all bound leases, not just dynamic ones.";
|
||||||
|
29="Added filter on log message text for 'log-forward'.";
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
# https://git.eworm.de/cgit/routeros-scripts/about/
|
# https://git.eworm.de/cgit/routeros-scripts/about/
|
||||||
|
|
||||||
# expected configuration version
|
# expected configuration version
|
||||||
:global ExpectedConfigVersion 28;
|
:global ExpectedConfigVersion 29;
|
||||||
|
|
||||||
# global variables not to be changed by user
|
# global variables not to be changed by user
|
||||||
:global GlobalFunctionsReady false;
|
:global GlobalFunctionsReady false;
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
:global Identity;
|
:global Identity;
|
||||||
:global LogForwardFilter;
|
:global LogForwardFilter;
|
||||||
|
:global LogForwardFilterMessage;
|
||||||
:global LogForwardLast;
|
:global LogForwardLast;
|
||||||
|
|
||||||
:global LogPrintExit;
|
:global LogPrintExit;
|
||||||
|
@ -29,7 +30,7 @@ $WaitFullyConnected;
|
||||||
:local Messages "";
|
:local Messages "";
|
||||||
:local MessageVal;
|
:local MessageVal;
|
||||||
|
|
||||||
:foreach Message in=[ / log find where !(topics~$LogForwardFilter) ] do={
|
:foreach Message in=[ / log find where !(topics~$LogForwardFilter) !(message~$LogForwardFilterMessage) ] do={
|
||||||
:set MessageVal [ / log get $Message ];
|
:set MessageVal [ / log get $Message ];
|
||||||
|
|
||||||
:if ($LogForwardLast = ($MessageVal->".id")) do={
|
:if ($LogForwardLast = ($MessageVal->".id")) do={
|
||||||
|
|
Loading…
Reference in a new issue