Module: check_mk
Branch: master
Commit: 0802cbb7a10bfc2d34ddc7494130bb40df853b1a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0802cbb7a10bfc…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Jan 31 14:58:45 2013 +0100
EC: peed up rule matches in some special cases by factor of 100 and more
---
ChangeLog | 1 +
mkeventd/bin/mkeventd | 5 +++++
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 16be061..8834d50 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -44,6 +44,7 @@
Event Console:
* Added UNIX socket for sending events to the EC
+ * Speed up rule matches in some special cases by factor of 100 and more
1.2.1i5:
Core:
diff --git a/mkeventd/bin/mkeventd b/mkeventd/bin/mkeventd
index 72256a2..fc05d77 100755
--- a/mkeventd/bin/mkeventd
+++ b/mkeventd/bin/mkeventd
@@ -1122,6 +1122,11 @@ class EventServer:
for key in [ "match", "match_ok",
"match_host", "match_application" ]:
if key in rule:
value = rule[key].strip()
+ # Remote leading .* from regex. This is redundant and
+ # dramatically destroys performance when doing an infix
search.
+ if key in [ "match", "match_ok" ]:
+ while value.startswith(".*") and not
value.startswith(".*?"):
+ value = value[2:]
if not value:
del rule[key]
continue