Module: check_mk
Branch: master
Commit: b8538679c7dafc9ae067d0815c49cbf04aacdf8b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b8538679c7dafc…
Author: Jukka Aro <ja(a)mathias-kettner.de>
Date: Fri Nov 24 14:43:00 2017 +0100
5413 FIX Windows agent: nocontext tag did not work for multibyte encoded logfiles
If a Windows logfile was encoded with a multibyte character encoding
the nocontext flag had no effect, always outputting the full context.
The nocontext tag now works correctly, in a way similar to single-byte
encoded logfiles.
Change-Id: Idcca870974ac26da4b8961ad35ba446d90b28897
---
.werks/5413 | 16 ++++++++++++++++
agents/windows/build_version | 2 +-
agents/windows/sections/SectionLogwatch.cc | 3 ++-
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/.werks/5413 b/.werks/5413
new file mode 100644
index 0000000..ab135d7
--- /dev/null
+++ b/.werks/5413
@@ -0,0 +1,16 @@
+Title: Windows agent: nocontext tag did not work for multibyte encoded logfiles
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i2
+Date: 1511530638
+Class: fix
+
+If a Windows logfile was encoded with a multibyte character encoding
+the nocontext flag had no effect, always outputting the full context.
+
+The nocontext tag now works correctly, in a way similar to single-byte
+encoded logfiles.
+
+
diff --git a/agents/windows/build_version b/agents/windows/build_version
index eab009b..e8fdf6b 100644
--- a/agents/windows/build_version
+++ b/agents/windows/build_version
@@ -1 +1 @@
-3006
+3008
diff --git a/agents/windows/sections/SectionLogwatch.cc
b/agents/windows/sections/SectionLogwatch.cc
index f179114..b436cf8 100644
--- a/agents/windows/sections/SectionLogwatch.cc
+++ b/agents/windows/sections/SectionLogwatch.cc
@@ -312,7 +312,8 @@ SectionLogwatch::processTextfileUnicode(FILE *file, logwatch_textfile
*textfile,
}
// Output line
- if (write_output && !output_buffer.empty()) {
+ if (write_output && !output_buffer.empty() &&
+ !(textfile->nocontext && (state == 'I' || state ==
'.'))) {
out << state << " " << output_buffer <<
"\n";
}