]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph.in: filter out audit from ceph -w 16345/head
authorJohn Spray <john.spray@redhat.com>
Fri, 14 Jul 2017 15:35:18 +0000 (11:35 -0400)
committerJohn Spray <john.spray@redhat.com>
Fri, 14 Jul 2017 15:35:18 +0000 (11:35 -0400)
...and add an optional --watch-channel argument.

Signed-off-by: John Spray <john.spray@redhat.com>
PendingReleaseNotes
src/ceph.in

index 572e45f438b2a4ca89425e083783f71b1dab4976..6f7266a37cd40f3803192c6ffcff0c086ca6a12e 100644 (file)
 * Certain extra fields in the 'ceph health' structured output that
   used to appear if the mons were low on disk space (which duplicated
   the information in the normal health warning messages) are now gone.
+
+* The "ceph -w" output no longer contains audit log entries by default.
+  Add a "--watch-channel=audit" or "--watch-channel=*" to see them.
+
index 6a6672a8592f0c14744169d61cd68f901eee0426..04c9ed2238f6f0d914b3f1b1eb357d1b7f91c41b 100755 (executable)
@@ -295,6 +295,11 @@ def parse_cmdargs(args=None, target=''):
     parser.add_argument('--watch-error', action='store_true',
                         help='watch error events')
 
+    parser.add_argument('--watch-channel', dest="watch_channel",
+                        help="which log channel to follow " \
+                        "when using -w/--watch.  One of ['cluster', 'audit', '*'",
+                        default='cluster')
+
     parser.add_argument('--version', '-v', action="store_true", help="display version")
     parser.add_argument('--verbose', action="store_true", help="make verbose")
     parser.add_argument('--concise', dest='verbose', action="store_false",
@@ -933,14 +938,16 @@ def main():
         if k.startswith('watch') and v:
             if k == 'watch':
                 level = 'info'
-            else:
+            elif k != "watch_channel":
                 level = k.replace('watch_', '')
     if level:
-
         # an awfully simple callback
-        def watch_cb(arg, line, who, stamp_sec, stamp_nsec, seq, level, msg):
-            print(line)
-            sys.stdout.flush()
+        def watch_cb(arg, line, channel, name, who, stamp_sec, stamp_nsec, seq, level, msg):
+            # Filter on channel
+            if (channel == parsed_args.watch_channel or \
+                           parsed_args.watch_channel == "*"):
+                print(line)
+                sys.stdout.flush()
 
         # first do a ceph status
         ret, outbuf, outs = json_command(cluster_handle, prefix='status')
@@ -951,7 +958,7 @@ def main():
 
         # this instance keeps the watch connection alive, but is
         # otherwise unused
-        run_in_thread(cluster_handle.monitor_log, level, watch_cb, 0)
+        run_in_thread(cluster_handle.monitor_log2, level, watch_cb, 0)
 
         # loop forever letting watch_cb print lines
         try: