From 7500b821aec731ac9d6cef17ad9651d5c6143c68 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 7 Jul 2021 12:14:36 -0400 Subject: [PATCH] cephadm: add bootstrap --log-to-file option Signed-off-by: Sage Weil --- doc/cephadm/install.rst | 5 +++++ src/cephadm/cephadm | 13 +++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/doc/cephadm/install.rst b/doc/cephadm/install.rst index 2a4a8887aceb2..25907296c5455 100644 --- a/doc/cephadm/install.rst +++ b/doc/cephadm/install.rst @@ -173,6 +173,11 @@ immediately to know more about ``cephadm bootstrap``, read the list below. Also, you can run ``cephadm bootstrap -h`` to see all of ``cephadm``'s available options. +* By default, Ceph daemons send their log output to stdout/stderr, which is picked + up by the container runtime (docker or podman) and (on most systems) sent to + journald. If you want Ceph to write traditional log files to ``/var/log/ceph/$fsid``, + use ``--log-to-file`` option during bootstrap. + * Larger Ceph clusters perform better when (external to the Ceph cluster) public network traffic is separated from (internal to the Ceph cluster) cluster traffic. The internal cluster traffic handles replication, recovery, diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 6d8e0a2f913db..5e8dd3ad1a3a5 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -3930,6 +3930,13 @@ def prepare_bootstrap_config( and not cp.has_option('mgr', 'mgr standby modules') ): cp.set('mgr', 'mgr_standby_modules', 'false') + if ctx.log_to_file: + cp.set('global', 'log_to_file', 'true') + cp.set('global', 'log_to_stderr', 'false') + cp.set('global', 'log_to_journald', 'false') + cp.set('global', 'mon_cluster_log_to_file', 'true') + cp.set('global', 'mon_cluster_log_to_stderr', 'false') + cp.set('global', 'mon_cluster_log_to_journald', 'false') cpf = StringIO() cp.write(cpf) @@ -7900,7 +7907,6 @@ def _get_parser(): '--ssh-user', default='root', help='set user for SSHing to cluster hosts, passwordless sudo will be needed for non-root users') - parser_bootstrap.add_argument( '--skip-mon-network', action='store_true', @@ -7956,7 +7962,6 @@ def _get_parser(): parser_bootstrap.add_argument( '--apply-spec', help='Apply cluster spec after bootstrap (copy ssh key, add hosts and apply services)') - parser_bootstrap.add_argument( '--shared_ceph_folder', metavar='CEPH_SOURCE_FOLDER', @@ -7994,6 +7999,10 @@ def _get_parser(): '--single-host-defaults', action='store_true', help='adjust configuration defaults to suit a single-host cluster') + parser_bootstrap.add_argument( + '--log-to-file', + action='store_true', + help='configure cluster to log to traditional log files in /var/log/ceph/$fsid') parser_deploy = subparsers.add_parser( 'deploy', help='deploy a daemon') -- 2.39.5