diff options
author | Etienne Champetier <e.champetier@ateme.com> | 2024-04-24 16:00:29 -0400 |
---|---|---|
committer | Jake Hunsaker <jacob.r.hunsaker@gmail.com> | 2024-04-25 16:37:02 -0400 |
commit | d8dc8c7730627ca756b00ffaa8b71225a3ac6e04 (patch) | |
tree | 86e4a8a6f4bce606438bc1ad6ecadb0581111f9e | |
parent | a0c2586e230c9600d3d3f70ab89c9f6eb52ed3ed (diff) | |
download | sos-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__.py | 1 | ||||
-rw-r--r-- | 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/*", |