]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: add a module option for controlling cephadm log dest
authorJohn Mulligan <jmulligan@redhat.com>
Wed, 6 Sep 2023 17:39:06 +0000 (13:39 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Tue, 19 Sep 2023 20:17:24 +0000 (16:17 -0400)
Now that cephadm has multiple possible persistent logging destinations
we need a way to choose which one to use when the command is started by
the mgr. Add the option 'cephadm_log_destination' which can take one
of 'file', 'syslog', or 'file,syslog'. If left unset (empty string)
then the behavior is equivalent to 'file' and that is the same as
previous cephadm versions.

Fixes: https://tracker.ceph.com/issues/62233
Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/pybind/mgr/cephadm/module.py
src/pybind/mgr/cephadm/serve.py

index 6bca82678b1752679f1137d4d4a9068f8a982e3c..df514a581cdae4b98bcc79eb9e868b4bea092522 100644 (file)
@@ -472,6 +472,13 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule,
             desc='Default timeout applied to cephadm commands run directly on '
             'the host (in seconds)'
         ),
+        Option(
+            'cephadm_log_destination',
+            type='str',
+            default='',
+            desc="Destination for cephadm command's persistent logging",
+            enum_allowed=['file', 'syslog', 'file,syslog'],
+        ),
     ]
 
     def __init__(self, *args: Any, **kwargs: Any):
@@ -554,6 +561,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule,
             self.cgroups_split = True
             self.log_refresh_metadata = False
             self.default_cephadm_command_timeout = 0
+            self.cephadm_log_destination = ''
 
         self.notify(NotifyType.mon_map, None)
         self.config_notify()
index 8fca46db436bbff6a58696647785eae1c957a367..a17ac151e3a68eea7ee88598fc0accb953eccf3e 100644 (file)
@@ -1577,6 +1577,11 @@ class CephadmServe:
             timeout -= 5
         final_args += ['--timeout', str(timeout)]
 
+        if self.mgr.cephadm_log_destination:
+            values = self.mgr.cephadm_log_destination.split(',')
+            for value in values:
+                final_args.append(f'--log-dest={value}')
+
         # subcommand
         if isinstance(command, list):
             final_args.extend([str(v) for v in command])