Skip to content

Support outputting systemd/journalctl logs in JSON format #591

@6A61736F6E206E61646572

Description

@6A61736F6E206E61646572

I would like to have the journalctl logs shown in logDNA to be in JSON format.

Would it be possible to add an env var to enable journald to output logs in JSON format?

Such that when enabled it would change 'export' in the code below to 'json-pretty':

pub fn create_journalctl_source() -> Result<impl Stream<Item = LineBuilder>, std::io::Error> {
let mut journalctl_process = tokio::process::Command::new(JOURNALCTL_CMD)
// The current boot
.arg("-b")
// follow
.arg("-f")
// set export format
.arg("-o")
.arg("export")
.stdout(Stdio::piped())
.spawn()?;

Or otherwise if there is another method that can achieve it at the moment?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions