aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Santoyo <alejandro.santoyo@canonical.com>2024-03-07 18:20:37 +0100
committerJake Hunsaker <jacob.r.hunsaker@gmail.com>2024-03-13 19:15:29 -0400
commitfe87bfc5642b8d579a0e9e71345f1a2b83625a30 (patch)
tree9f563f02cbed5537710f27bc1bcc7166fbe57e68
parent12e6f43965d25054debff936f61acacbe4bb8066 (diff)
downloadsos-fe87bfc5642b8d579a0e9e71345f1a2b83625a30.tar.gz
[ceph] Ensure `all-logs` is enforced for Ceph plugins
Currently Ceph plugins do not take the `all-logs` flag into account which means that even if this flag is set compressed log files are not collected This patch fixes that. Resolves: SET-480 Signed-off-by: Alejandro Santoyo <alejandro.santoyo@canonical.com>
-rw-r--r--sos/report/plugins/ceph_common.py26
-rw-r--r--sos/report/plugins/ceph_iscsi.py28
-rw-r--r--sos/report/plugins/ceph_mds.py12
-rw-r--r--sos/report/plugins/ceph_mgr.py22
-rw-r--r--sos/report/plugins/ceph_mon.py22
-rw-r--r--sos/report/plugins/ceph_osd.py12
-rw-r--r--sos/report/plugins/ceph_rgw.py10
7 files changed, 106 insertions, 26 deletions
diff --git a/sos/report/plugins/ceph_common.py b/sos/report/plugins/ceph_common.py
index eb4282bd..77c42167 100644
--- a/sos/report/plugins/ceph_common.py
+++ b/sos/report/plugins/ceph_common.py
@@ -54,14 +54,18 @@ class CephCommon(Plugin, RedHatPlugin, UbuntuPlugin):
})
if not all_logs:
- self.add_copy_spec("/var/log/calamari/*.log",)
+ self.add_copy_spec([
+ "/var/log/calamari/*.log",
+ "/var/log/ceph/**/ceph.log",
+ ])
else:
- self.add_copy_spec("/var/log/calamari",)
+ self.add_copy_spec([
+ "/var/log/calamari",
+ "/var/log/ceph/**/ceph.log*",
+ ])
self.add_copy_spec([
- "/var/log/ceph/**/ceph.log",
"/var/log/ceph/**/ceph.audit.log*",
- "/var/log/calamari/*.log",
"/etc/ceph/",
"/etc/calamari/",
"/var/lib/ceph/tmp/",
@@ -80,10 +84,16 @@ class CephCommon(Plugin, RedHatPlugin, UbuntuPlugin):
"/etc/ceph/*bindpass*"
])
else:
- self.add_copy_spec([
- "/var/snap/microceph/common/logs/ceph.log",
- "/var/snap/microceph/common/logs/ceph.audit.log",
- ])
+ if not all_logs:
+ self.add_copy_spec([
+ "/var/snap/microceph/common/logs/ceph.log",
+ "/var/snap/microceph/common/logs/ceph.audit.log",
+ ])
+ else:
+ self.add_copy_spec([
+ "/var/snap/microceph/common/logs/ceph.log*",
+ "/var/snap/microceph/common/logs/ceph.audit.log*",
+ ])
self.add_cmd_output([
"ceph -v",
diff --git a/sos/report/plugins/ceph_iscsi.py b/sos/report/plugins/ceph_iscsi.py
index ac6d505c..a4c7da25 100644
--- a/sos/report/plugins/ceph_iscsi.py
+++ b/sos/report/plugins/ceph_iscsi.py
@@ -20,14 +20,26 @@ class CephISCSI(Plugin, RedHatPlugin, UbuntuPlugin):
containers = ("rbd-target-api.*", "rbd-target-gw.*")
def setup(self):
- self.add_copy_spec([
- "/etc/tcmu/tcmu.conf",
- "/var/log/**/ceph-client.*.log",
- "/var/log/**/rbd-target-api.log",
- "/var/log/**/rbd-target-gw.log",
- "/var/log/**/tcmu-runner.log",
- "/var/log/tcmu-runner.log"
- ])
+ all_logs = self.get_option("all_logs")
+
+ self.add_copy_spec(["/etc/tcmu/tcmu.conf",])
+
+ if not all_logs:
+ self.add_copy_spec([
+ "/var/log/**/ceph-client.*.log",
+ "/var/log/**/rbd-target-api.log",
+ "/var/log/**/rbd-target-gw.log",
+ "/var/log/**/tcmu-runner.log",
+ "/var/log/tcmu-runner.log"
+ ])
+ else:
+ self.add_copy_spec([
+ "/var/log/**/ceph-client.*.log*",
+ "/var/log/**/rbd-target-api.log*",
+ "/var/log/**/rbd-target-gw.log*",
+ "/var/log/**/tcmu-runner.log*",
+ "/var/log/tcmu-runner.log*"
+ ])
self.add_cmd_output([
"gwcli info",
diff --git a/sos/report/plugins/ceph_mds.py b/sos/report/plugins/ceph_mds.py
index a5a5edeb..b04c9afc 100644
--- a/sos/report/plugins/ceph_mds.py
+++ b/sos/report/plugins/ceph_mds.py
@@ -18,12 +18,22 @@ class CephMDS(Plugin, RedHatPlugin, UbuntuPlugin):
files = ('/var/lib/ceph/mds/*',)
def setup(self):
+ all_logs = self.get_option("all_logs")
+
self.add_file_tags({
'/var/log/ceph/ceph-mds.*.log': 'ceph_mds_log',
})
+ if not all_logs:
+ self.add_copy_spec([
+ "/var/log/ceph/ceph-mds*.log",
+ ])
+ else:
+ self.add_copy_spec([
+ "/var/log/ceph/ceph-mds*.log*",
+ ])
+
self.add_copy_spec([
- "/var/log/ceph/ceph-mds*.log",
"/var/lib/ceph/bootstrap-mds/",
"/var/lib/ceph/mds/",
"/run/ceph/ceph-mds*",
diff --git a/sos/report/plugins/ceph_mgr.py b/sos/report/plugins/ceph_mgr.py
index a1c23c8c..579cf199 100644
--- a/sos/report/plugins/ceph_mgr.py
+++ b/sos/report/plugins/ceph_mgr.py
@@ -43,6 +43,7 @@ class CephMGR(Plugin, RedHatPlugin, UbuntuPlugin):
containers = ('ceph-(.*-)?mgr.*',)
def setup(self):
+ all_logs = self.get_option("all_logs")
microceph_pkg = self.policy.package_manager.pkg_by_name('microceph')
ceph_mgr_cmds = ([
@@ -106,8 +107,16 @@ class CephMGR(Plugin, RedHatPlugin, UbuntuPlugin):
"/etc/ceph/*bindpass*",
])
+ if not all_logs:
+ self.add_copy_spec([
+ "/var/log/ceph/**/ceph-mgr*.log",
+ ])
+ else:
+ self.add_copy_spec([
+ "/var/log/ceph/**/ceph-mgr*.log*",
+ ])
+
self.add_copy_spec([
- "/var/log/ceph/**/ceph-mgr*.log",
"/var/lib/ceph/**/mgr*",
"/var/lib/ceph/**/bootstrap-mgr/",
"/run/ceph/**/ceph-mgr*",
@@ -124,9 +133,14 @@ class CephMGR(Plugin, RedHatPlugin, UbuntuPlugin):
"/var/snap/microceph/common/**/*keyring*",
])
- self.add_copy_spec([
- "/var/snap/microceph/common/logs/ceph-mgr*.log",
- ])
+ if not all_logs:
+ self.add_copy_spec([
+ "/var/snap/microceph/common/logs/ceph-mgr*.log",
+ ])
+ else:
+ self.add_copy_spec([
+ "/var/snap/microceph/common/logs/ceph-mgr*.log*",
+ ])
self.add_cmd_output(
[f"ceph {cmd}" for cmd in ceph_mgr_cmds])
diff --git a/sos/report/plugins/ceph_mon.py b/sos/report/plugins/ceph_mon.py
index 3a7cc130..8980e5d4 100644
--- a/sos/report/plugins/ceph_mon.py
+++ b/sos/report/plugins/ceph_mon.py
@@ -42,7 +42,7 @@ class CephMON(Plugin, RedHatPlugin, UbuntuPlugin):
ceph_version = 0
def setup(self):
-
+ all_logs = self.get_option("all_logs")
self.ceph_version = self.get_ceph_version()
microceph_pkg = self.policy.package_manager.pkg_by_name('microceph')
@@ -61,10 +61,18 @@ class CephMON(Plugin, RedHatPlugin, UbuntuPlugin):
"/etc/ceph/*bindpass*"
])
+ if not all_logs:
+ self.add_copy_spec([
+ "/var/log/ceph/**/*ceph-mon*.log"
+ ])
+ else:
+ self.add_copy_spec([
+ "/var/log/ceph/**/*ceph-mon*.log*"
+ ])
+
self.add_copy_spec([
"/run/ceph/**/ceph-mon*",
"/var/lib/ceph/**/kv_backend",
- "/var/log/ceph/**/*ceph-mon*.log"
])
else:
@@ -75,9 +83,17 @@ class CephMON(Plugin, RedHatPlugin, UbuntuPlugin):
"/var/snap/microceph/common/state/*",
])
+ if not all_logs:
+ self.add_copy_spec([
+ "/var/snap/microceph/common/logs/*ceph-mon*.log",
+ ])
+ else:
+ self.add_copy_spec([
+ "/var/snap/microceph/common/logs/*ceph-mon*.log*",
+ ])
+
self.add_copy_spec([
"/var/snap/microceph/common/data/mon/*",
- "/var/snap/microceph/common/logs/*ceph-mon*.log",
"/var/snap/microceph/current/conf/*",
])
diff --git a/sos/report/plugins/ceph_osd.py b/sos/report/plugins/ceph_osd.py
index 36ade251..6eec21ba 100644
--- a/sos/report/plugins/ceph_osd.py
+++ b/sos/report/plugins/ceph_osd.py
@@ -37,6 +37,7 @@ class CephOSD(Plugin, RedHatPlugin, UbuntuPlugin):
'/var/snap/microceph/common/data/osd/*')
def setup(self):
+ all_logs = self.get_option("all_logs")
directory = ''
microceph_pkg = self.policy.package_manager.pkg_by_name('microceph')
cmds = [
@@ -103,6 +104,12 @@ class CephOSD(Plugin, RedHatPlugin, UbuntuPlugin):
"ceph-volume lvm list"
])
+ if all_logs:
+ self.add_copy_spec([
+ "/var/log/ceph/**/ceph-osd*.log*",
+ "/var/log/ceph/**/ceph-volume*.log*",
+ ])
+
else:
directory = '/var/snap/microceph'
# Only collect microceph files, don't run any commands
@@ -117,6 +124,11 @@ class CephOSD(Plugin, RedHatPlugin, UbuntuPlugin):
"/var/snap/microceph/common/logs/*ceph-osd*.log",
])
+ if all_logs:
+ self.add_copy_spec([
+ "/var/snap/microceph/common/logs/*ceph-osd*.log*",
+ ])
+
# common add_cmd_output for ceph and microceph
self.add_cmd_output([
f"ceph daemon {i} {c}" for i in
diff --git a/sos/report/plugins/ceph_rgw.py b/sos/report/plugins/ceph_rgw.py
index 9688d528..202cbeb6 100644
--- a/sos/report/plugins/ceph_rgw.py
+++ b/sos/report/plugins/ceph_rgw.py
@@ -19,8 +19,14 @@ class CephRGW(Plugin, RedHatPlugin, UbuntuPlugin):
files = ('/var/lib/ceph/radosgw/*',)
def setup(self):
- self.add_copy_spec('/var/log/ceph/ceph-client.rgw*.log',
- tags='ceph_rgw_log')
+ all_logs = self.get_option("all_logs")
+
+ if not all_logs:
+ self.add_copy_spec('/var/log/ceph/ceph-client.rgw*.log',
+ tags='ceph_rgw_log')
+ else:
+ self.add_copy_spec('/var/log/ceph/ceph-client.rgw*.log*',
+ tags='ceph_rgw_log')
self.add_forbidden_path([
"/etc/ceph/*keyring*",