From f550ca98508fe13c80e13f9903cfeb70303956f8 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Wed, 6 Sep 2023 13:39:06 -0400 Subject: [PATCH] mgr/cephadm: add a module option for controlling cephadm log dest 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 --- src/pybind/mgr/cephadm/module.py | 8 ++++++++ src/pybind/mgr/cephadm/serve.py | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 6bca82678b175..df514a581cdae 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -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() diff --git a/src/pybind/mgr/cephadm/serve.py b/src/pybind/mgr/cephadm/serve.py index 8fca46db436bb..a17ac151e3a68 100644 --- a/src/pybind/mgr/cephadm/serve.py +++ b/src/pybind/mgr/cephadm/serve.py @@ -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]) -- 2.39.5