[systemd-devel] Trying to get journalctl -M UUID to work with docker containers
Daniel J Walsh
dwalsh at redhat.com
Mon Feb 8 15:21:56 CET 2016
On 02/08/2016 08:18 AM, Mantas Mikulėnas wrote:
> On Mon, Feb 8, 2016 at 3:09 PM, Daniel J Walsh <dwalsh at redhat.com
> <mailto:dwalsh at redhat.com>> wrote:
>
> I have patches into docker to allow it to register with machinectl and
> run systemd inside of the container without --privileges. I also
> set it
> up so that the /var/log/journald/UUID on the host is mounted inside of
> the container, so that journald inside of the container writes to this
> location on the host.
>
> Then I use journalctl -M UUID on the host to look at the host journal.
> When I run the first container it works great. I see the
> container, but
> when I run the second container, I end up seeing the first countainers
> journal again. If I strace journalctl -M uuid it looks like it is
> reading all of the journals under /var/log/journalctl rather then just
> the one for UUID.
>
> Am I doing something wrong when I set this up? How is this
> supposed to
> work?
>
>
> If I remember correctly, -M adds a filter for _MACHINE_ID and
> _BOOT_ID? Try `SYSTEMD_LOG_LEVEL=debug journalctl -M <uuid>` to
> verify. Maybe your containers actually have identical '/etc/machine-id's?
>
> --
> Mantas Mikulėnas <grawity at gmail.com <mailto:grawity at gmail.com>>
docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
69730c6f4b85 httpd "/sbin/init" 7 minutes ago Up 7 minutes 80/tcp httpd
c8174de954b6 httpd "/sbin/init" 22 hours ago Up 7 minutes 80/tcp httpd1
# machinectl
MACHINE CLASS SERVICE
69730c6f4b85ea61f5b9ddb9fb68cf7b container docker
c8174de954b6e3037926dfa8b15cc854 container docker
# docker exec httpd cat /etc/machine-id
69730c6f4b85ea61f5b9ddb9fb68cf7b
# docker exec httpd1 cat /etc/machine-id
c8174de954b6e3037926dfa8b15cc854
No the /etc/machine-id is different, if I enter the container I see differences.
# docker exec httpd journalctl | head -1
-- Logs begin at Mon 2016-02-08 14:10:37 UTC, end at Mon 2016-02-08 14:10:38 UTC. --
# docker exec httpd1 journalctl | head -1
-- Logs begin at Sun 2016-02-07 15:36:19 UTC, end at Mon 2016-02-08 14:10:49 UTC. --
# journalctl -M 69730c6f4b85ea61f5b9ddb9fb68cf7b | head -1
-- Logs begin at Sun 2016-02-07 09:59:39 EST, end at Mon 2016-02-08 09:18:20 EST. --
# journalctl -M c8174de954b6e3037926dfa8b15cc854 | head -1
-- Logs begin at Sun 2016-02-07 09:59:39 EST, end at Mon 2016-02-08 09:18:40 EST. --
Where should I go for the output of this?
SYSTEMD_LOG_LEVEL=debug journalctl -M <uuid>
Is there a way for me to see the settings of _MACHINE_ID and _BOOT_ID? Also how can I see the actual path to the file journalctl is
reading?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20160208/5d804b4c/attachment.html>
More information about the systemd-devel
mailing list