| Summary: | Container log output shouldn't show up in `journalctl -u docker` | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Andy Goldstein <agoldste> |
| Component: | docker | Assignee: | Nalin Dahyabhai <nalin> |
| Status: | CLOSED CANTFIX | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | rawhide | CC: | adimania, admiller, amurdaca, dwalsh, ichavero, jcajka, jchaloup, lsm5, marianne, miminar, nalin, rmeggins, vbatts |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2016-05-04 18:04:54 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: | |
|
Description
Andy Goldstein
2016-04-18 18:12:29 UTC
What is the journalctl command to get the container output? journalctl -u $containerid? journalctl CONTAINER_ID=$short_id or journalctl CONTAINER_ID_FULL=$full_id I am not sure if this is how this works. The problem here is the unit file is grabbing all stdout and stderr as it goes back to the client. This output would be the same if you used the json log or the journal log. If you use the json logger, those entries don't show up in `journalctl -u docker` The logged messages are not going to the journal when you use the json logger, so they wouldn't. When using the journald log driver, output is logged to the journal by the docker daemon on behalf of whatever's running inside of the container, so journald, which adds metadata to log entries describing where the message came from, assigns them metadata that attributes them to the docker daemon, which is why they get mixed in with messages that actually originate from the daemon. Adding an OBJECT_PID to messages (per systemd.journal-fields(5)) once it's available doesn't seem to be triggering the addition of metadata like OBJECT_SYSTEMD_UNIT, which could be a seperate problem. We can't override _MACHINE_ID from the docker daemon, either. Accounting for whether or not forward-journald (per bug #1300076) is in use, journalctl -u docker _TRANSPORT=stdout + OBJECT_EXE=docker should filter the output down to just the messages that you want. The OBJECT_PID bug will be fixed fixed in systemd PR#3129. Without larger changes, journalctl -M won't be able to pull up a container's logs. I'm still looking at what will be required to make that work. I don't think we're going to be able to change this. The simplest alternative to having the docker daemon send messages to the journal, which is what leads to those messages being counted along with other messages from the daemon, is to run a per-container journald and send messages to its listening socket. Basically, if the docker daemon is writing to the host's journal socket, the journald daemon is really, really good at figuring out that it's us. While logging a container's output to a journald instance running in a container would keep those messages from being mixed in with the daemon's, it's not something we can switch to doing as a general strategy because we can't guarantee that there's a journald to run in every container. In cases where there is one running, the journal files either live inside the container (i.e., they'd disappear when the container is destroyed, which would be a step back from having them survive, as they do now), or they'd be in a location that wouldn't be vacuumed automatically, which would likely require additional management to avoid running out of space. I'm going to mark this as can't-fix, then. |