Joao Figueiredo Joao Figueiredo - 5 months ago 60
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?


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.