Created
July 27, 2018 16:50
-
-
Save kylemanna/af5d544614411beccfb8df6ef7422126 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# Process blobs in journalctl logs | |
# | |
# journalctl -f -o json | ./journalctl-blob-to-txt.py | jq . | |
# | |
import sys | |
import json | |
if __name__ == '__main__': | |
fixed=[] | |
for line in sys.stdin: | |
d = json.loads(line) | |
if type(d['MESSAGE']) == list: | |
a = [str(unichr(i)) for i in d['MESSAGE']] | |
d['MESSAGE'] = ''.join(a).strip() | |
fixed.append(d) | |
print(json.dumps(fixed)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment