Bug 981048
| Summary: | RFE: introduce journal command that dumps kernel: [ cut here ]/[ end trace] entries from the journal | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Jóhann B. Guðmundsson <johannbg> |
| Component: | systemd | Assignee: | systemd-maint |
| Status: | CLOSED WONTFIX | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | rawhide | CC: | johannbg, lnykryn, msekleta, notting, plautrba, systemd-maint, vpavlin, zbyszek |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2013-07-26 01:43:44 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 784611 | ||
|
Description
Jóhann B. Guðmundsson
2013-07-03 21:10:32 UTC
Try this ;)
------------[ cut here ]------------
#!/usr/bin/python
from __future__ import print_function
import re
from systemd import journal
j = journal.Reader()
first = True
while True:
j.add_match('_TRANSPORT=kernel')
j.add_match(MESSAGE='------------[ cut here ]------------')
line = j.get_next()
if not line:
break
j.flush_matches()
j.add_match('_TRANSPORT=kernel')
if first:
first = False
else:
print()
while line:
print(line['MESSAGE'])
if re.match(r'---\[ end trace [a-z0-9]+ \]---', line['MESSAGE']):
break
line = j.get_next()
---[ end trace deadbeef ]---
If generally useful, we could make this into a proper script and stick it in systemd. What kind of functionality would you need? Last trace? Last n traces? Traces from this boot? Save to a file? Postprocess somehow?
Well the general idea here is to make it super easy to report those traces so I would assume only uniq traces would be useful and save to file and potentially flush entries or somehow flag it having being saved ( to prevent report duplicates by reporters themselves ) from journal to attach to bug report. I would assume tools like ABRT would take advantage of this or use this somehow as well. Nah, this is nothing we ever want to do in the journal itself: detect messages by their text contents. I can see the usefulness for this, but people should user message_ids for that, nothing else. Of course it's difficult convincing kernel folks about that, but I still don't think we should work around that. Also note that abrt does something like this anyway, afaik, to process the messages further. I don't think we need to do this in journald itself, as it couldn't do anything with that data anyway, but abrt can. |