From d8dc8c7730627ca756b00ffaa8b71225a3ac6e04 Mon Sep 17 00:00:00 2001 From: Etienne Champetier Date: Wed, 24 Apr 2024 16:00:29 -0400 Subject: [plugins] apply --since to all journal collection If user limit logs with --since, there is no reasons to have logs older than the limit. Signed-off-by: Etienne Champetier --- sos/report/plugins/__init__.py | 1 + sos/report/plugins/logs.py | 10 +++------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/sos/report/plugins/__init__.py b/sos/report/plugins/__init__.py index 00fa15fc..504b0f30 100644 --- a/sos/report/plugins/__init__.py +++ b/sos/report/plugins/__init__.py @@ -2959,6 +2959,7 @@ class Plugin(): boot = "-1" journal_cmd += boot_opt % boot + since = since or self.get_option('since') if since: journal_cmd += since_opt % since diff --git a/sos/report/plugins/logs.py b/sos/report/plugins/logs.py index 04c14529..31448cc2 100644 --- a/sos/report/plugins/logs.py +++ b/sos/report/plugins/logs.py @@ -22,8 +22,6 @@ class LogsBase(Plugin): confs = ['/etc/syslog.conf', rsyslog] logs = [] - since = self.get_option("since") - if self.path_exists(rsyslog): with open(self.path_join(rsyslog), 'r', encoding='UTF-8') as conf: for line in conf.readlines(): @@ -65,12 +63,10 @@ class LogsBase(Plugin): journal = any(self.path_exists(self.path_join(p, "log/journal/")) for p in ["/var", "/run"]) if journal and self.is_service("systemd-journald"): - self.add_journal(since=since, tags=['journal_full', 'journal_all'], + self.add_journal(tags=['journal_full', 'journal_all'], priority=100) - self.add_journal(boot="this", since=since, - tags='journal_since_boot') - self.add_journal(boot="last", since=since, - tags='journal_last_boot') + self.add_journal(boot="this", tags='journal_since_boot') + self.add_journal(boot="last", tags='journal_last_boot') if self.get_option("all_logs"): self.add_copy_spec([ "/var/log/journal/*", -- cgit