From 431df83e0a8f77d8dadc15d0e7e2438b734c8833 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Mon, 18 Jul 2011 16:10:53 -0700 Subject: [PATCH] rgw: radosgw_admin log show dumps parsable json --- src/rgw/rgw_admin.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 3402aeb4f5468..364ee6a549aec 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -827,6 +827,11 @@ int main(int argc, char **argv) struct rgw_log_entry entry; const char *delim = " "; + if (format) { + formatter->init(); + formatter->open_array_section("Log"); + } + while (!iter.end()) { ::decode(entry, iter); @@ -847,7 +852,6 @@ int main(int argc, char **argv) << "\"" << escape_str(entry.user_agent, '"') << "\"" << delim << "\"" << escape_str(entry.referrer, '"') << "\"" << std::endl; } else { - formatter->init(); formatter->open_obj_section("LogEntry"); formatter->dump_value_str("Bucket", "%s", entry.bucket.c_str()); @@ -872,6 +876,12 @@ int main(int argc, char **argv) formatter->flush(cout); } } + + if (format) { + formatter->close_section("Log"); + formatter->flush(cout); + } + } if (opt_cmd == OPT_USER_RM) { -- 2.39.5