From 9848582239d61e5cfcbac09301a5b2ac55bc6a37 Mon Sep 17 00:00:00 2001 From: Timothy Stack Date: Sun, 2 Mar 2014 15:19:34 -0800 Subject: [PATCH] fix an error when parsing json logs --- src/log_format_loader.cc | 2 ++ src/logfile.cc | 1 + 2 files changed, 3 insertions(+) diff --git a/src/log_format_loader.cc b/src/log_format_loader.cc index 191fdbf3..c491b1a0 100644 --- a/src/log_format_loader.cc +++ b/src/log_format_loader.cc @@ -391,11 +391,13 @@ void load_formats(std::vector &errors) string format_path = dotlnav_path("formats/*/*.json"); static_root_mem gl; + log_info("loading formats from path: %s", format_path.c_str()); if (glob(format_path.c_str(), 0, NULL, gl.inout()) == 0) { for (int lpc = 0; lpc < (int)gl->gl_pathc; lpc++) { string filename(gl->gl_pathv[lpc]); auto_fd fd; + log_info("loading formats from file: %s", filename.c_str()); yajlpp_parse_context ypc(filename, format_handlers); if ((fd = open(gl->gl_pathv[lpc], O_RDONLY)) == -1) { char errmsg[1024]; diff --git a/src/logfile.cc b/src/logfile.cc index f471b5a9..2d7a6a75 100644 --- a/src/logfile.cc +++ b/src/logfile.cc @@ -256,6 +256,7 @@ throw (line_buffer::error, logfile::error) if (len > 0 && line[len - 1] == '\n') { this->lf_partial_line = false; line[len - 1] = '\0'; + len -= 1; } else { this->lf_partial_line = true;