aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEtienne Champetier <e.champetier@ateme.com>2024-04-24 16:00:29 -0400
committerJake Hunsaker <jacob.r.hunsaker@gmail.com>2024-04-25 16:37:02 -0400
commitd8dc8c7730627ca756b00ffaa8b71225a3ac6e04 (patch)
tree86e4a8a6f4bce606438bc1ad6ecadb0581111f9e
parenta0c2586e230c9600d3d3f70ab89c9f6eb52ed3ed (diff)
downloadsos-d8dc8c7730627ca756b00ffaa8b71225a3ac6e04.tar.gz
[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 <e.champetier@ateme.com>
-rw-r--r--sos/report/plugins/__init__.py1
-rw-r--r--sos/report/plugins/logs.py10
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/*",