aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2018-04-30 17:02:42 +0100
committerBryn M. Reeves <bmr@redhat.com>2018-04-30 17:02:42 +0100
commitd8f121a19a2ed49f6dd6be6162602b5f9004208e (patch)
tree624ec11f66b1d3ab3867cf0ec690d031e945eccf
parentcee249fe9f3a676841959a6ccd57c44f1f77b693 (diff)
downloadsos-d8f121a19a2ed49f6dd6be6162602b5f9004208e.tar.gz
[Plugin] add 'catalog=True|False' to Plugin.add_journal()
Allow users of add_journal() to also collect message catalogs for the logs returned. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/__init__.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index 580c0941..ea19ee57 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -789,25 +789,28 @@ class Plugin(object):
def add_journal(self, units=None, boot=None, since=None, until=None,
lines=None, allfields=False, output=None, timeout=None,
- identifier=None):
+ identifier=None, catalog=None):
""" Collect journald logs from one of more units.
Keyword arguments:
- units -- A string, or list of strings specifying the systemd
+ units -- A string, or list of strings specifying the systemd
units for which journal entries will be collected.
- boot -- A string selecting a boot index using the journalctl
+ boot -- A string selecting a boot index using the journalctl
syntax. The special values 'this' and 'last' are also
accepted.
- since -- A string representation of the start time for journal
+ since -- A string representation of the start time for journal
messages.
- until -- A string representation of the end time for journal
+ until -- A string representation of the end time for journal
messages.
- lines -- The maximum number of lines to be collected.
- allfields -- Include all journal fields regardless of size or
+ lines -- The maximum number of lines to be collected.
+ allfields -- Include all journal fields regardless of size or
non-printable characters.
- output -- A journalctl output control string, for example
+ output -- A journalctl output control string, for example
"verbose".
- timeout -- An optional timeout in seconds.
+ timeout -- An optional timeout in seconds.
+ identifier -- an optional message identifier.
+ catalog -- If True, augment lines with descriptions from the
+ system catalog.
"""
journal_cmd = "journalctl --no-pager "
unit_opt = " --unit %s"
@@ -817,6 +820,7 @@ class Plugin(object):
lines_opt = " --lines %s"
output_opt = " --output %s"
identifier_opt = " --identifier %s"
+ catalog_opt = " --catalog"
if isinstance(units, six.string_types):
units = [units]
@@ -828,6 +832,9 @@ class Plugin(object):
if identifier:
journal_cmd += identifier_opt % identifier
+ if catalog:
+ journal_cmd += catalog_opt
+
if allfields:
journal_cmd += " --all"