Re: Access journal log files within Docker Container using sd-journal API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

Does "journalctl --file=…" work?
You mean inside the container, right?
I installed systemd in the container and tried the following command:

journalctl --file /var/log/journal/<machine-id>/system.journal

and it printed: Failed to open files: Protocol not supported

So no, it does indeed not work.


Sebastian

On 09/03/2021 10:36, Lennart Poettering wrote:
On Di, 09.03.21 10:24, Sebastian Borchers (sebastian@xxxxxxxxxxxxx) wrote:

Hello,

I have a question. I am trying to read journald log files within a
docker container on a host that is using systemd.
Inside the container, systemd is NOT running. I want to use a library
that uses the sd-journal API to read the logs within the container.

I tried the following docker cmd:

/docker run --rm --interactive --tty \//
//        --net host \//
//        //--privileged \//
//        //-v /run:/run \//
//        -v /var:/var \//
//        --mount type=bind,source=/sys/fs/cgroup,target=/sys/fs/cgroup \//
//        --mount type=bind,source=/sys/fs/fuse,target=/sys/fs/fuse \
        myContainer:latest
/

When running my code inside this container, though, the log files are
always empty.
Running the same code on my host machine correctly yields the log files.
Does "journalctl --file=…" work?


Lennart

--
Lennart Poettering, Berlin
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux