]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-daemon: 'logs' command 31575/head
authorSage Weil <sage@redhat.com>
Tue, 12 Nov 2019 16:42:00 +0000 (10:42 -0600)
committerSage Weil <sage@redhat.com>
Tue, 12 Nov 2019 20:17:03 +0000 (14:17 -0600)
This just invokes podman logs with the appropriate argument(s).

Signed-off-by: Sage Weil <sage@redhat.com>
src/ceph-daemon/ceph-daemon

index 4c09d6eafc5f558a4f4d788798f8c079d9965bb0..87a8dbcf51f3992775885ae3ad6b50707346e2c9 100755 (executable)
@@ -1307,6 +1307,20 @@ def command_unit():
 
 ##################################
 
+def command_logs():
+    cmd = [podman_path, 'logs']
+    if args.follow:
+        cmd.append('-f')
+    if args.tail:
+        cmd.append('--tail=' + str(args.tail))
+    cmd.append('ceph-%s-%s' % (args.fsid, args.name))
+
+    # call this directly, without our wrapper, so that we get an unmolested
+    # stdout with logger prefixing.
+    subprocess.call(cmd)
+
+##################################
+
 def command_ls():
     ls = list_daemons(detail=not args.no_detail)
     print(json.dumps(ls, indent=4))
@@ -1698,6 +1712,25 @@ def _get_parser():
         required=True,
         help='daemon name (type.id)')
 
+    parser_logs = subparsers.add_parser(
+        'logs', help='fetch the log for a daemon\'s container')
+    parser_logs.set_defaults(func=command_logs)
+    parser_logs.add_argument(
+        '--fsid',
+        required=True,
+        help='cluster FSID')
+    parser_logs.add_argument(
+        '--name', '-n',
+        required=True,
+        help='daemon name (type.id)')
+    parser_logs.add_argument(
+        '-f', '--follow',
+        action='store_true',
+        help='Follow log output')
+    parser_logs.add_argument(
+        '--tail',
+        help='Output the specified number of lines at the end of the log')
+
     parser_bootstrap = subparsers.add_parser(
         'bootstrap', help='bootstrap a cluster (mon + mgr daemons)')
     parser_bootstrap.set_defaults(func=command_bootstrap)