Read systemd-journald records programatically in real time.

Latest response

I need to tap into the systemd-journald records in a real time fashion from C/C++ program. Read a record as it is generated, and then extract each field (key/value pairs) in the record for further processing. What would be an efficient way of doing this? Any help and examples will be greatly appreciated.

Thank you.

Responses

Use sd-journal library. There's an example that (probably) does what you want in sd_journal_wait manpage.