From: Yehuda Sadeh Date: Wed, 26 Oct 2011 23:07:04 +0000 (-0700) Subject: rgw: rgw-admin --skip-zero-entries X-Git-Tag: v0.38~50 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e8e101580ea04628713f51171e9af58aec1acbd2;p=ceph.git rgw: rgw-admin --skip-zero-entries --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index f4aa7acc0b75..cd88c4d18dab 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -79,6 +79,8 @@ void _usage() cerr << " user data\n"; cerr << " --show-log-entries= enable/disable dump of log entries on log show\n"; cerr << " --show-log-sum= enable/disable dump of log summation on log show\n"; + cerr << " --skip-zero-entries log show only dumps entries that don't have zero value\n"; + cerr << " in one of the numeric field\n"; generic_client_usage(); } @@ -498,6 +500,7 @@ int main(int argc, char **argv) int pretty_format = false; int show_log_entries = true; int show_log_sum = true; + int skip_zero_entries = false; // log show std::string val; std::ostringstream errs; @@ -544,6 +547,8 @@ int main(int argc, char **argv) // do nothing } else if (ceph_argparse_binary_flag(args, i, &show_log_sum, NULL, "--show_log_sum", (char*)NULL)) { // do nothing + } else if (ceph_argparse_binary_flag(args, i, &skip_zero_entries, NULL, "--skip_zero_entries", (char*)NULL)) { + // do nothing } else if (ceph_argparse_withlonglong(args, i, &tmp, &errs, "-a", "--auth-uid", (char*)NULL)) { if (!errs.str().empty()) { cerr << errs.str() << std::endl; @@ -1082,6 +1087,10 @@ int main(int argc, char **argv) agg_bytes_received += entry.bytes_received; total_entries++; + if (skip_zero_entries && entry.bytes_sent == 0 && + entry.bytes_received == 0) + goto next; + if (show_log_entries) { formatter->open_object_section("log_entry"); formatter->dump_string("bucket", entry.bucket.c_str()); @@ -1104,7 +1113,7 @@ int main(int argc, char **argv) formatter->close_section(); formatter->flush(cout); } - +next: r = store->log_show_next(h, &entry); } while (r > 0); diff --git a/src/test/cli/radosgw-admin/help.t b/src/test/cli/radosgw-admin/help.t index 7822f6dea567..590d21e44306 100644 --- a/src/test/cli/radosgw-admin/help.t +++ b/src/test/cli/radosgw-admin/help.t @@ -51,6 +51,8 @@ user data --show-log-entries= enable/disable dump of log entries on log show --show-log-sum= enable/disable dump of log summation on log show + --skip-zero-entries log show only dumps entries that don't have zero value + in one of the numeric field --conf/-c Read configuration from the given configuration file -d Run in foreground, log to stderr. -f Run in foreground, log to usual location.