From bb7225f4c43670e5f21b83bd2877da35841de467 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Tue, 22 Aug 2023 15:11:35 -0400 Subject: [PATCH] cephadm: add cli option to enable logging to syslog Add the --log-dest option to cephadm. The --log-dest option can be specified 0, 1 or more times. If unspecified, cephadm will log to the default location, the log file. If specified one ore more times, each instance will enable the named logging destination. Example: ``` cephadm boostrap cephadm --log-dest=syslog bootstrap cephadm --log-dest=file bootstrap cephadm --log-dest=syslog --log-dest=file bootstrap ``` Signed-off-by: John Mulligan --- src/cephadm/cephadm.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cephadm/cephadm.py b/src/cephadm/cephadm.py index fb40a9d67f537..5d14ea773eca6 100755 --- a/src/cephadm/cephadm.py +++ b/src/cephadm/cephadm.py @@ -137,7 +137,7 @@ from cephadmlib.net_utils import ( from cephadmlib.locking import FileLock from cephadmlib.daemon_identity import DaemonIdentity, DaemonSubIdentity from cephadmlib.packagers import create_packager, Packager -from cephadmlib.logging import cephadm_init_logging, Highlight +from cephadmlib.logging import cephadm_init_logging, Highlight, LogDestination FuncT = TypeVar('FuncT', bound=Callable) @@ -8813,6 +8813,11 @@ def _get_parser(): '--verbose', '-v', action='store_true', help='Show debug-level log messages') + parser.add_argument( + '--log-dest', + action='append', + choices=[v.name for v in LogDestination], + help='select one or more destination for persistent logging') parser.add_argument( '--timeout', type=int, -- 2.39.5