aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2020-09-25 22:21:59 +0200
committerGravatar Christian Hesse <mail@eworm.de>2020-09-25 22:21:59 +0200
commit697e32a30640c7bb8c132aaed44968081e6e3872 (patch)
tree8bef82332df7bb9273f1159604bc21bdce977367
parentc3ea55523371403f07f116cb44eebfdf444c5628 (diff)
log-forward: add filter on log message textchange-29
-rw-r--r--doc/log-forward.md3
-rw-r--r--global-config5
-rw-r--r--global-config-overlay2
-rw-r--r--global-config.changes1
-rw-r--r--global-functions2
-rw-r--r--log-forward3
6 files changed, 11 insertions, 5 deletions
diff --git a/doc/log-forward.md b/doc/log-forward.md
index bc7213a..afb695e 100644
--- a/doc/log-forward.md
+++ b/doc/log-forward.md
@@ -31,9 +31,10 @@ Just install the script:
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
+* `LogForwardFilterMessage`: define message text *not* to be forwarded
Also notification settings are required for e-mail and telegram.
diff --git a/global-config b/global-config
index 18754a8..446628f 100644
--- a/global-config
+++ b/global-config
@@ -8,7 +8,7 @@
# Make sure all configuration properties are up to date and this
# value is in sync with value in script 'global-functions'!
-:global GlobalConfigVersion 28;
+:global GlobalConfigVersion 29;
# This is used for DNS and backup file.
:global Domain "example.com";
@@ -48,6 +48,9 @@
# This defines a filter on log topics not to be forwarded.
: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.
# The configured channel (bugfix, current, release-candidate) is appended.
diff --git a/global-config-overlay b/global-config-overlay
index 48dbb9c..93c55ae 100644
--- a/global-config-overlay
+++ b/global-config-overlay
@@ -9,7 +9,7 @@
# Make sure all configuration properties are up to date and this
# value is in sync with value in script 'global-functions'!
# Comment or remove to disable change notifications.
-:global GlobalConfigVersion 28;
+:global GlobalConfigVersion 29;
# Copy configuration from global-config here and modify it.
diff --git a/global-config.changes b/global-config.changes
index e260565..605ceac 100644
--- a/global-config.changes
+++ b/global-config.changes
@@ -32,4 +32,5 @@
26="Made check count threshold in 'netwatch-notify' configurable.";
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.";
+ 29="Added filter on log message text for 'log-forward'.";
};
diff --git a/global-functions b/global-functions
index adb9733..2d25b34 100644
--- a/global-functions
+++ b/global-functions
@@ -8,7 +8,7 @@
# https://git.eworm.de/cgit/routeros-scripts/about/
# expected configuration version
-:global ExpectedConfigVersion 28;
+:global ExpectedConfigVersion 29;
# global variables not to be changed by user
:global GlobalFunctionsReady false;
diff --git a/log-forward b/log-forward
index 59a47c1..dc2ad05 100644
--- a/log-forward
+++ b/log-forward
@@ -8,6 +8,7 @@
:global Identity;
:global LogForwardFilter;
+:global LogForwardFilterMessage;
:global LogForwardLast;
:global LogPrintExit;
@@ -29,7 +30,7 @@ $WaitFullyConnected;
:local Messages "";
: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 ];
:if ($LogForwardLast = ($MessageVal->".id")) do={