Skip to content

[Filebeat/Journald] When in a container, use chroot to run journalctl from the host, thus eliminating version issues #47323

@belimawr

Description

@belimawr

Currently we ship the journalctl binary in some of our Docker images, which allow users to read the journal from the host, however if their Journald version is not compatible with the journalctl version in our container, the journal cannot be ingested.

This can be fixed by using chroot + a custom path to run journalctl directly from the host without having to have the binary available in our container nor any other required library to run it.

The implementation itself is simple, we just need to set SysProcAttr.Chroot and the full path (see golang/go#39341) of the journalctl binary inside the chroot when creating the exec.Cmd.

I saw this clever solution when reviewing a OTel PR.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions