Bug 1011790 - [RFE] Redirect log messages to a file
[RFE] Redirect log messages to a file
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: docker-io (Show other bugs)
rawhide
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Lokesh Mandvekar
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-25 03:17 EDT by Marek Goldmann
Modified: 2014-07-01 18:59 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-01-03 16:24:21 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Marek Goldmann 2013-09-25 03:17:34 EDT
Description of problem:

Currently the log messages are placed in the /var/log/messages file. This makes it hard to read the logs. It would be good to create and redirect logs to the /var/log/docker.log file.

Below is an example snippet of my /var/log/messages file.

Sep 25 08:55:41 localhost systemd: Failed to open private bus connection: Failed to connect to socket /run/user/0/dbus/user_bus_socket: No such file or directory
Sep 25 08:55:41 localhost systemd: Mounted /sys/kernel/config.
Sep 25 08:55:41 localhost systemd: Stopped target Sound Card.
Sep 25 08:55:41 localhost systemd: Starting Default.
Sep 25 08:55:41 localhost systemd: Reached target Default.
Sep 25 08:55:41 localhost systemd: Startup finished in 7ms.
Sep 25 08:55:41 localhost systemd: Started User Manager for 0.
Sep 25 08:55:48 localhost systemd: Starting Stop Read-Ahead Data Collection...
Sep 25 08:55:48 localhost systemd: Started Stop Read-Ahead Data Collection.
Sep 25 08:55:57 localhost docker: 2013/09/25 08:55:57 GET /v1.5/containers/json
Sep 25 08:56:00 localhost docker: 2013/09/25 08:56:00 GET /v1.5/containers/json?all=1
Sep 25 08:56:14 localhost docker: 2013/09/25 08:56:14 GET /v1.5/containers/json
Sep 25 08:56:16 localhost docker: 2013/09/25 08:56:16 GET /v1.5/containers/json?all=1
Sep 25 08:56:39 localhost docker: 2013/09/25 08:56:39 GET /v1.5/containers/json
Sep 25 08:56:43 localhost docker: 2013/09/25 08:56:43 GET /v1.5/containers/json?all=1
Sep 25 08:56:49 localhost docker: 2013/09/25 08:56:49 GET /v1.5/containers/json?all=1
Sep 25 08:56:49 localhost docker: 2013/09/25 08:56:49 DELETE /v1.5/containers/046cda0988c3
Sep 25 08:56:49 localhost kernel: [   93.058243] loop: module loaded
Sep 25 08:56:49 localhost docker: 2013/09/25 08:56:49 DELETE /v1.5/containers/98b88506cab6
Sep 25 08:56:49 localhost docker: 2013/09/25 08:56:49 DELETE /v1.5/containers/83f601fe9fc7
Sep 25 08:56:49 localhost docker: 2013/09/25 08:56:49 DELETE /v1.5/containers/e6accafef6b2
Sep 25 08:56:49 localhost docker: 2013/09/25 08:56:49 DELETE /v1.5/containers/1fc682d3984e
Sep 25 08:56:49 localhost docker: 2013/09/25 08:56:49 DELETE /v1.5/containers/fc37da0e8420
Sep 25 08:56:49 localhost docker: 2013/09/25 08:56:49 DELETE /v1.5/containers/b62405e9c2e6
Sep 25 08:56:49 localhost docker: 2013/09/25 08:56:49 DELETE /v1.5/containers/6541307c35fe
Sep 25 08:56:49 localhost docker: 2013/09/25 08:56:49 DELETE /v1.5/containers/54df66115c27
Sep 25 08:56:49 localhost docker: 2013/09/25 08:56:49 DELETE /v1.5/containers/c74c163f122b
Sep 25 08:56:49 localhost docker: 2013/09/25 08:56:49 DELETE /v1.5/containers/81b23d471da3
Sep 25 08:56:49 localhost docker: 2013/09/25 08:56:49 DELETE /v1.5/containers/40cf1a63ff20
Comment 1 Matthew Miller 2013-09-25 08:28:31 EDT
I think this goes against the basic strategy of logging we have in Fedora. Instead, try:

   jounrnalctl -b /usr/bin/docker            #  <- tab completion will work

or more-terse (no hostname or pid)

   journalctl -b -o cat /usr/bin/docker
Comment 2 Matthew Miller 2013-09-25 08:34:02 EDT
On the other hand, there's no need for docker to be logging the _date_.  https://github.com/dotcloud/docker/issues/2003
Comment 3 Lokesh Mandvekar 2013-09-25 21:15:43 EDT
(In reply to Matthew Miller from comment #2)
> On the other hand, there's no need for docker to be logging the _date_. 
> https://github.com/dotcloud/docker/issues/2003


Perhaps this is a generic golang thing and not docker specific. Following is a relevant snippet from $GOROOT/src/pkg/log/log.go


// These flags define which text to prefix to each log entry generated by the Logger.
const (
        // Bits or'ed together to control what's printed. There is no control over the
        // order they appear (the order listed here) or the format they present (as
        // described in the comments).  A colon appears after these items:
        //      2009/01/23 01:23:23.123123 /a/b/c/d.go:23: message
        Ldate         = 1 << iota     // the date: 2009/01/23
        Ltime                         // the time: 01:23:23
        Lmicroseconds                 // microsecond resolution: 01:23:23.123123.  assumes Ltime.
        Llongfile                     // full file name and line number: /a/b/c/d.go:23
        Lshortfile                    // final file name element and line number: d.go:23. overrides Llongfile
        LstdFlags     = Ldate | Ltime // initial values for the standard logger
)
Comment 4 Dan Mace 2013-11-20 09:37:59 EST
Sounds like the original bug is WONTFIX, since the systemd logging behavior is correct/desirable.

As to the logging format issue, it doesn't appear we can patch downstream since the Go stdlib Logger format is hard-coded: at best, you can configure a prefix string. So, we can't patch Docker to use a new format.

To change the format would require an upstream change to Go to make the Logger format configurable, or to Docker to use a different logging implementation, and in either case propagate that configurability to the packager.

I think the logging format issue should be a separate issue of some sort regardless.
Comment 5 Lokesh Mandvekar 2014-01-03 16:24:21 EST
(In reply to Dan Mace from comment #4)
> Sounds like the original bug is WONTFIX, since the systemd logging behavior
> is correct/desirable.
> 
> As to the logging format issue, it doesn't appear we can patch downstream
> since the Go stdlib Logger format is hard-coded: at best, you can configure
> a prefix string. So, we can't patch Docker to use a new format.
> 
> To change the format would require an upstream change to Go to make the
> Logger format configurable, or to Docker to use a different logging
> implementation, and in either case propagate that configurability to the
> packager.
> 
> I think the logging format issue should be a separate issue of some sort
> regardless.


Thanks Dan.

Note You need to log in before you can comment on or make changes to this bug.