diff options
author | Jake Hunsaker <jhunsake@redhat.com> | 2022-08-01 10:54:59 -0400 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2022-08-01 13:23:03 -0400 |
commit | ebee62fcddc89e19233797fc0c3619611d350b17 (patch) | |
tree | 6f8551b89d1e5b3cde13902a5fc4077d5107ef7c | |
parent | 2499e27b3422567ff7f1a785542ec0ec15bf99fa (diff) | |
download | sos-ebee62fcddc89e19233797fc0c3619611d350b17.tar.gz |
[Plugin] Don't log content of captured strings
Stop logging the contents of strings added via `add_string_as_file()`.
This can ultimately be used via sizelimiting mechanisms, which means we
effectively are writing the entire sizelimited content twice, which can
make the logs needlessly bloated and harder to quickly navigate.
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r-- | sos/report/plugins/__init__.py | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/sos/report/plugins/__init__.py b/sos/report/plugins/__init__.py index 7b4e28b8..4c466008 100644 --- a/sos/report/plugins/__init__.py +++ b/sos/report/plugins/__init__.py @@ -2248,14 +2248,9 @@ class Plugin(): :type tags: ``str`` or a ``list`` of strings """ - # Generate summary string for logging - summary = content.splitlines()[0] if content else '' - if not isinstance(summary, str): - summary = content.decode('utf8', 'ignore') - if not self.test_predicate(cmd=False, pred=pred): - self._log_info("skipped string ...'%s' due to predicate (%s)" % - (summary, self.get_predicate(pred=pred))) + self._log_info("skipped string due to predicate (%s)" % + (self.get_predicate(pred=pred))) return sos_dir = 'sos_commands' if plug_dir else 'sos_strings' @@ -2265,7 +2260,7 @@ class Plugin(): tags = [tags] self.copy_strings.append((content, filename, tags)) - self._log_debug("added string ...'%s' as '%s'" % (summary, filename)) + self._log_debug("added string as '%s'" % filename) def _collect_cmd_output(self, cmd, suggest_filename=None, root_symlink=False, timeout=None, @@ -3085,13 +3080,7 @@ class Plugin(): for string, file_name, tags in self.copy_strings: if self._timeout_hit: return - content = '' - if string: - content = string.splitlines()[0] - if not isinstance(content, str): - content = content.decode('utf8', 'ignore') - self._log_info("collecting string ...'%s' as '%s'" - % (content, file_name)) + self._log_info("collecting string as '%s'" % file_name) try: self.archive.add_string(string, file_name) _name = file_name.split('/')[-1].replace('.', '_') |