[sheepdog] [PATCH RFC 0/3] logger: selectable log format

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Mon Jan 28 12:15:23 CET 2013


This patch set implements a mechanism for selectable log format in
logger. Current logger writes log in a fixed format. It is hard to
parse by machine. So the only wai to read logs is opening them with
text editors or pagers.

This patch set implements logging in json format as an example. So we
can write programs like pretty printers or state machines on
them. These might be helpful for debugging and analyzing sheepdog.

This is an example of a log formatted in json:
{"time": "1359367663", "worker_name": "main", "worker_idx": 0, "func":
"jrnl_recover", "line": 230, "body": "opening the directory
/store/sheep/journal/"}

A similar log line formatted in default style is like this:
Jan 28 20:07:52 [main] jrnl_recover(230) opening the directory
/store/sheep/journal/

(My personal intention is using this feature for debugging shepherd :)

Hitoshi Mitake (3):
  logger: format in logger process
  logger: json format for logging
  logger: selectable log format

 include/logger.h |    2 +-
 lib/logger.c     |  127 +++++++++++++++++++++++++++++++++++++++++++++--------
 sheep/sheep.c    |    8 +++-
 3 files changed, 115 insertions(+), 22 deletions(-)

-- 
1.7.2.5




More information about the sheepdog mailing list