<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hello,</p>
<p>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">Does "journalctl --file=…" work?</pre>
</blockquote>
You mean inside the container, right? <br>
I installed systemd in the container and tried the following
command:</p>
<p>journalctl --file
/var/log/journal/<machine-id>/system.journal</p>
<p>and it printed: <b>Failed to open files: Protocol not supported</b></p>
<p>So no, it does indeed not work. <br>
</p>
<p><br>
</p>
<p>Sebastian<br>
</p>
<div class="moz-cite-prefix">On 09/03/2021 10:36, Lennart Poettering
wrote:<br>
</div>
<blockquote type="cite" cite="mid:YEdBi6UkiSWsumCd@gardel-login">
<pre class="moz-quote-pre" wrap="">On Di, 09.03.21 10:24, Sebastian Borchers (<a class="moz-txt-link-abbreviated" href="mailto:sebastian@desertbit.com">sebastian@desertbit.com</a>) wrote:
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">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.
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
Does "journalctl --file=…" work?
Lennart
--
Lennart Poettering, Berlin
</pre>
</blockquote>
</body>
</html>