Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fall back to dmesg if kern.log not found #1003

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion hotsos/core/plugins/kernel/kernlog/calltrace.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,8 @@ def __init__(self, *args, **kwargs):

def run(self):
for tracetype in self.tracetypes:
self.searcher.add(tracetype.searchdef, self.path)
self.searcher.add(tracetype.searchdef, self.path[0],
allow_global_constraints=self.path[1])

self.results = self.searcher.run()
for tracetype in self.tracetypes:
Expand Down
19 changes: 16 additions & 3 deletions hotsos/core/plugins/kernel/kernlog/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,21 @@ def __init__(self):

@property
def path(self):
"""
Return path we want to search. By default we search kern.log but that
may not exist e.g. if rsyslogd is not running so fallback to dmesg if
not.

@return: tuple (path, bool value indicating whether to allow global
search constraints on the path)
"""
path = os.path.join(HotSOSConfig.data_root, 'var/log/kern.log')
if HotSOSConfig.use_all_logs:
return f"{path}*"
if os.path.exists(path):
if HotSOSConfig.use_all_logs:
path = f"{path}*"

return path, True

return path
# NOTE: don't allow constraints for dmesg since it doesn't have
# proper timestamps.
return os.path.join(HotSOSConfig.data_root, 'var/log/dmesg'), False
3 changes: 2 additions & 1 deletion hotsos/core/plugins/kernel/kernlog/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ class KernLogEvents(KernLogBase):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
for event in [self.over_mtu_dropped_packets_search_def]:
self.searcher.add(event, self.path)
self.searcher.add(event, self.path[0],
allow_global_constraints=self.path[1])

self.results = self.searcher.run()

Expand Down
Loading