Skip to content

Commit

Permalink
koremonitor.py: b64 encode bytes journal record fields.
Browse files Browse the repository at this point in the history
koremonitor couldn't proceed when journal record contain bytes field
like 'COREDUMP_PROC_AUXV'
  • Loading branch information
Sergey-Kitov committed Apr 17, 2023
1 parent f8c63fe commit 1aa7aae
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions koremonitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
Generates /koredump/index.json with data on available cores.
"""

import base64
import json
import logging
import os
Expand Down Expand Up @@ -143,6 +144,8 @@ def fmt_journal_entry(self, entry):
entry[k] = str(v.timestamp)
elif isinstance(v, datetime):
entry[k] = v.isoformat() + "Z"
elif isinstance(v, bytes):
entry[k] = base64.b64encode(v).decode('ascii')
elif not isinstance(v, (str, int)):
self.logger.error(k, v)
return entry
Expand Down

0 comments on commit 1aa7aae

Please sign in to comment.