[sheepdog] [PATCH v2 0/3] logger: selectable log format
Hitoshi Mitake
mitake.hitoshi at lab.ntt.co.jp
Tue Jan 29 10:30:13 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 :)
v2
* change some coding style problems pointed by Liu Yuan
* trivial bug fixes
* use gettimeofday() instead of time() for timestamp
Hitoshi Mitake (3):
logger: format in logger process
logger: JSON format for logging
sheep: add new option -F for selecting log format
include/logger.h | 2 +-
lib/logger.c | 151 +++++++++++++++++++++++++++++++++++++++++++++---------
sheep/sheep.c | 8 +++-
3 files changed, 135 insertions(+), 26 deletions(-)
--
1.7.2.5
More information about the sheepdog
mailing list