On 26/07/2019 09:57, Zefir Kurtisi wrote:
On 7/25/19 5:58 PM, John Crispin wrote:
On 25/07/2019 17:43, Zefir Kurtisi wrote:
This adds filtering options for facilities as follows:
-z <facility> handle only messages with given facility (0-23),
repeatable
-Z <facility> ignore messages with given facility (0-23), repeatable
With that
* 'logread -z 2 -z 16' will display all MAIL and LOCAL0 messages, while
* 'logread -Z 2 -Z 16' will display all but MAIL and LOCAL0 messages
Signed-off-by: Zefir Kurtisi <[email protected]>
---
log/logread.c | 29 +++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/log/logread.c b/log/logread.c
index e47541a..a764742 100644
--- a/log/logread.c
+++ b/log/logread.c
@@ -66,6 +66,18 @@ static int log_type = LOG_STDOUT;
static int log_size, log_udp, log_follow, log_trailer_null = 0;
static int log_timestamp;
static int logd_conn_tries = LOGD_CONNECT_RETRY;
+static int facility_include;
+static int facility_exclude;
+
+/* check for facility filter; return 0 if message shall be dropped */
+static int check_facility_filter(int f)
+{
+ if (facility_include)
+ return !!(facility_include & (1 << f));
+ if (facility_exclude)
+ return !(facility_exclude & (1 << f));
+ return 1;
+}
correct me if I am wrong but by default all facilities will be included so the
-z
is a noop unless we add a
if (facility_include)
retrun 0
at the end of this function ?!
John
Hi John,
if you pick at least one facility to include, you get into the topmost
'if (facility_include)' branch of the function and return immediately. You get
to
the end of the function only if both (include and exclude) are 0.
This implies that including facilities has precedence over excluding them, which
is irrelevant since it does not make sense to use include and exclude at the
same
time.
Cheers,
Zefir
apparently I was blind
John
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel