Joao Figueiredo Joao Figueiredo - 25 days ago 19
C++ Question

C++ library for log parsing

Is there any C++ library specifically for log parsing (helping recognize multiline events)?
Like MergeLog for Apache logs or libcurl for web parsing?

Answer

Unless you stumble upon a suitable library, my advice would be to use a standalone lexer.

  • Instead of flex + bison, use flex alone (C/C++).
  • Instead of ocamllex + ocamlyacc, use ocamllex alone (OCaml).
  • Ragel (C/C++/Objective C/D/Java/Ruby).

This way you avoid having to define a grammar (which is kind of pointless for log files anyway) and you avoid the dreaded frankenstein-regex-monster sometimes seen in dark places.

Comments