| Summary: | docker logs useless messages to journald | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Jakub Filak <jfilak> |
| Component: | docker | Assignee: | Daniel Walsh <dwalsh> |
| Status: | CLOSED NOTABUG | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | rawhide | CC: | adimania, admiller, amurdaca, dwalsh, ichavero, jberan, jcajka, jchaloup, lsm5, marianne, miminar, nalin, riek, vbatts |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2016-10-19 13:58:58 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
docker logs all stdout/stderr to journal, that is by design. You can specify alternative loggers via the docker run command. Heck to see if the journald Hello ended up somewhere else. Not sure what happened to it. Unless systemd/journald is doing something to drop the message. sh-4.3# python <<< "from systemd import journal; journal.send('journald Hello')"
sh-4.3# logger "journald logger Hello"
sh-4.3# exit
sh-4.3# journalctl -b | grep Hello
Oct 19 09:53:28 dhcp-10-19-62-196.boston.devel.redhat.com root[16787]: journald logger Hello
I think the journal call would send directly to the journal socket.
This works for me.
docker run -ti -v /dev/log:/dev/log -v /var/run/systemd/journal/socket:/var/run/systemd/journal/socket --name journald fedora sh
python <<< "from systemd import journal; journal.send('journald Hello')"
journalctl -b | grep HelloOct 19 09:53:28 dhcp-10-19-62-196.boston.devel.redhat.com root[16787]: journald logger Hello
Oct 19 09:57:51 dhcp-10-19-62-196.boston.devel.redhat.com python[17523]: journald Hello
I wrote a blog on this. Hopefully will be published on projectatomic.io https://github.com/projectatomic/atomic-site/issues/367 |
Description of problem: Any command issued in a interactive docker container produces a message in journald like the following one: Oct 19 13:43:16 photon dockerd-current[3002]: [6B blob data] and direct logging to journald from the container does not work: # docker run -it -v /dev/log:/dev/log fedora /usr/bin/bash # dnf install systemd-python # python <<< "from systemd import journal; journal.send('journald Hello')" # logger "Hello" On host: Oct 19 13:47:59 photon dockerd-current[3002]: [107B blob data] Oct 19 13:47:59 photon root[4354]: Hello Version-Release number of selected component (if applicable): docker-1.12.2-3.git15c82b8.fc26.x86_64 How reproducible: Always Steps to Reproduce: 1. docker run -v /dev/log:/dev/log -it fedora /usr/bin/bash 2. echo "Hello!" 3. dnf install python-systemd 4. python <<< "from systemd import journal; journal.send('journald Hello')" Actual results: Oct 19 13:57:50 photon dockerd-current[3002]: [54B blob data] Oct 19 13:57:50 photon dockerd-current[3002]: [4B blob data] Oct 19 14:04:22 photon dockerd-current[3002]: [116B blob data] Expected results: Oct 19 13:57:50 photon python[3213]: journald Hello