Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support outputting systemd/journalctl logs in JSON format #591

Open
6A61736F6E206E61646572 opened this issue Dec 12, 2023 · 0 comments
Open

Comments

@6A61736F6E206E61646572
Copy link

6A61736F6E206E61646572 commented Dec 12, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant