summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/rules.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/bin/rules.c b/src/bin/rules.c
index 91227b2..ee5f66d 100644
--- a/src/bin/rules.c
+++ b/src/bin/rules.c
@@ -269,13 +269,19 @@ int rules_filtermessage(struct logmessage *new_logmessage)
269 } 269 }
270 } 270 }
271 271
272 // Now we check for message filtering 272 // For every regex affected to the rule, we apply it to the
273 // Log message we got to see if we have something to filter
273 EINA_LIST_FOREACH(foundrule->list_regex, l2, foundregex) 274 EINA_LIST_FOREACH(foundrule->list_regex, l2, foundregex)
274 { 275 {
275 size_t nmatch = 2; 276 size_t nmatch = 2;
276 regmatch_t pmatch[2]; 277 regmatch_t pmatch[2];
277 278
278 ret = regexec(&(foundregex->preg), new_logmessage->message,nmatch, pmatch, 0); 279 ret = regexec(&(foundregex->preg), new_logmessage->message,nmatch, pmatch, 0);
280
281 // If regexec returns 0, then the log message matches the regex.
282 // If regexec returns 1, then the log message doesnt match the regex.
283 // So if the regex must match (message= or message_match= in rule, so must_match=1) or musnt match (message_unmatch=, must_match=0),
284 // We can consider that the message must be filtered if regex returns something different than 'must_match'
279 if( ret == foundregex->must_match ) 285 if( ret == foundregex->must_match )
280 { 286 {
281 EINA_LOG_DOM_INFO(einadom_rules, "Log \"%s\" from \"%s\" is not affected by rule %s (message exclude : %s / %d / %d)", new_logmessage->message, new_logmessage->source_path, foundrule->name, foundregex->message, foundregex->must_match, ret); 287 EINA_LOG_DOM_INFO(einadom_rules, "Log \"%s\" from \"%s\" is not affected by rule %s (message exclude : %s / %d / %d)", new_logmessage->message, new_logmessage->source_path, foundrule->name, foundregex->message, foundregex->must_match, ret);