Module: check_mk
Branch: master
Commit: fe3a48ebffa242f95043b7702ea263b25eaeba70
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fe3a48ebffa242…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Jan 30 17:25:36 2013 +0100
Improved performance of logwatch.ec check in case of many messages
---
ChangeLog | 1 +
checks/logwatch | 7 ++++---
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2ca36a8..769a6a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -21,6 +21,7 @@
* FIX: logwatch.ec: use UNIX socket instead of Pipe for forwarding into EC
* FIX: logwatch.ec: fixed exception when forwarding "OK" lines
* FIX: logwatch.ec: fixed forwarding of single log lines to event console
+ * Improved performance of logwatch.ec check in case of many messages
* livestatus_status: new check for monitoring performance of monitoring
Multisite:
diff --git a/checks/logwatch b/checks/logwatch
index 1fd8f04..b42c87e 100644
--- a/checks/logwatch
+++ b/checks/logwatch
@@ -432,11 +432,12 @@ def check_logwatch_ec(_unused, params, info):
# 2. create syslog message of each line
# <128> Oct 24 10:44:27 Klappspaten /var/log/syslog: Oct 24 10:44:27
Klappspaten logger: asdasdad as
# <facility+priority> timestamp hostname logfile: message
- facility = params.get('facility', 17) # default to "local1"
+ facility = params.get('facility', 17) << 3 # default to
"local1"
messages = []
+ cur_time = syslog_time()
for logfile, line in logs:
- msg = '<%d>' % ((facility << 3) +
logwatch_to_prio(line[0]),)
- msg += '%s %s %s: %s' % (syslog_time(), g_hostname, logfile, line[2:])
+ msg = '<%d>' % (facility + logwatch_to_prio(line[0]),)
+ msg += '%s %s %s: %s' % (cur_time, g_hostname, logfile, line[2:])
messages.append(msg)
# 3. send lines to event console