diff --git a/src/line_buffer.cc b/src/line_buffer.cc index 52166078..66a44d03 100644 --- a/src/line_buffer.cc +++ b/src/line_buffer.cc @@ -522,6 +522,7 @@ bool line_buffer::read_line(off_t &offset, line_value &lv, bool include_delim) else { if (lv.lv_len > 1 && line_start[lv.lv_len - 1] == '\r') { lv.lv_len -= 1; + offset += 1; } offset += 1; /* Skip the delimiter. */ } diff --git a/src/logfile.cc b/src/logfile.cc index 30bf46e0..24437a35 100644 --- a/src/logfile.cc +++ b/src/logfile.cc @@ -255,12 +255,12 @@ bool logfile::process_prefix(off_t offset, shared_buffer_ref &sbr) last_mod = ll.get_module_id(); last_opid = ll.get_opid(); } - this->lf_index.push_back(logline(offset, - last_time, - last_millis, - last_level, - last_mod, - last_opid)); + this->lf_index.emplace_back(offset, + last_time, + last_millis, + last_level, + last_mod, + last_opid); break; } case log_format::SCAN_INCOMPLETE: diff --git a/test/Makefile.am b/test/Makefile.am index 7881ff8e..8a629b5c 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -291,6 +291,7 @@ dist_noinst_DATA = \ logfile_bro_conn.log.0 \ logfile_bro_http.log.0 \ logfile_blued.0 \ + logfile_crlf.0 \ logfile_cxx.0 \ logfile_empty.0 \ logfile_epoch.0 \ diff --git a/test/logfile_crlf.0 b/test/logfile_crlf.0 new file mode 100644 index 00000000..501ee633 --- /dev/null +++ b/test/logfile_crlf.0 @@ -0,0 +1,2 @@ +2012-07-02 10:22:40,672:DEBUG:foo bar baz +2014-10-08 16:56:38,344:WARN:foo bar baz diff --git a/test/test_logfile.sh b/test/test_logfile.sh index 8a4de5ff..b4825138 100644 --- a/test/test_logfile.sh +++ b/test/test_logfile.sh @@ -360,6 +360,13 @@ check_output "rewriting machine-oriented timestamp didn't work?" <