aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sos/report/plugins/logs.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/sos/report/plugins/logs.py b/sos/report/plugins/logs.py
index c92cc1f0..e3b6b884 100644
--- a/sos/report/plugins/logs.py
+++ b/sos/report/plugins/logs.py
@@ -59,13 +59,21 @@ class Logs(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin, CosPlugin):
self.add_cmd_output("journalctl --disk-usage")
self.add_cmd_output('ls -alRh /var/log/')
- journal = os.path.exists("/var/log/journal/")
- if journal and self.is_installed("systemd"):
+ # collect journal logs if:
+ # - there is some data present, either persistent or runtime only
+ # - systemd-journald service exists
+ # otherwise fallback to collecting few well known logfiles directly
+ journal = any([os.path.exists(p + "/log/journal/")
+ for p in ["/var", "/run"]])
+ if journal and self.is_service("systemd-journald"):
self.add_journal(since=since)
- self.add_journal(boot="this", catalog=True)
- self.add_journal(boot="last", catalog=True)
+ self.add_journal(boot="this", catalog=True, since=since)
+ self.add_journal(boot="last", catalog=True, since=since)
if self.get_option("all_logs"):
- self.add_copy_spec("/var/log/journal/*")
+ self.add_copy_spec([
+ "/var/log/journal/*",
+ "/run/log/journal/*"
+ ])
else: # If not using journal
if not self.get_option("all_logs"):
self.add_copy_spec([