Skip to content

syslog driver combines stderr and stdout #33834

@schmichael

Description

@schmichael

Description

stdout and stderr get logged to the syslog driver with the same facility and severity (aka "priority" in some places).

Steps to reproduce the issue:

On

  1. docker run -d --log-driver="syslog" python:2-alpine python -c 'import sys; sys.stderr.write("STDERRTEST")'; sleep 1; journalctl -o verbose MESSAGE=STDERRTEST
  2. docker run -d --log-driver="syslog" python:2-alpine python -c 'import sys; sys.stderr.write("STDOUTTEST")'; sleep 1; journalctl -o verbose MESSAGE=STDOUTTEST

Describe the results you received:

From 1 above:

Mon 2017-06-26 17:42:49.997757 PDT [s=785ccf7f72a24397843e29771a71bbff;i=105db7;b=a1871f72dd5d467485c10eda4286842d;
...
    PRIORITY=6
    SYSLOG_FACILITY=3
    _UID=0
    _GID=0
    _SYSTEMD_SLICE=system.slice
    _CAP_EFFECTIVE=3fffffffff
    _TRANSPORT=syslog
    _PID=2059
    _COMM=dockerd
    _EXE=/usr/bin/dockerd
    _CMDLINE=/usr/bin/dockerd -H fd://
    _SYSTEMD_CGROUP=/system.slice/docker.service
    _SYSTEMD_UNIT=docker.service
    _SYSTEMD_INVOCATION_ID=4693661fde2d43ee801d7257da35b2d6
    SYSLOG_PID=2059
    MESSAGE=STDERRTEST
    SYSLOG_IDENTIFIER=3276ddd33e00
    _SOURCE_REALTIME_TIMESTAMP=1498524169997757

From 2:

Mon 2017-06-26 17:44:12.243358 PDT [s=785ccf7f72a24397843e29771a71bbff;i=105e15;b=a1871f72dd5d467485c10eda4286842d;
...
    PRIORITY=6
    SYSLOG_FACILITY=3
    _UID=0
    _GID=0
    _SYSTEMD_SLICE=system.slice
    _CAP_EFFECTIVE=3fffffffff
    _TRANSPORT=syslog
    _PID=2059
    _COMM=dockerd
    _EXE=/usr/bin/dockerd
    _CMDLINE=/usr/bin/dockerd -H fd://
    _SYSTEMD_CGROUP=/system.slice/docker.service
    _SYSTEMD_UNIT=docker.service
    _SYSTEMD_INVOCATION_ID=4693661fde2d43ee801d7257da35b2d6
    SYSLOG_PID=2059
    SYSLOG_IDENTIFIER=a76fdfc70efb
    MESSAGE=STDOUTTEST
    _SOURCE_REALTIME_TIMESTAMP=1498524252243358

Describe the results you expected:

https://github.com/moby/moby/blob/master/daemon/logger/syslog/syslog.go#L134-L141

Leads me to believe stderr will get the priority level error (3), but as you can see in the journalctl output both log lines are logged with priority level info (6).

Output of docker version:

Client:
 Version:      17.05.0-ce
 API version:  1.29
 Go version:   go1.7.5
 Git commit:   89658be
 Built:        Thu May  4 22:10:54 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.05.0-ce
 API version:  1.29 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   89658be
 Built:        Thu May  4 22:10:54 2017
 OS/Arch:      linux/amd64
 Experimental: false

Output of docker info:

Containers: 31
 Running: 1
 Paused: 0
 Stopped: 30
Images: 10
Server Version: 17.05.0-ce
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 131
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 9048e5e50717ea4497b757314bad98ea3763c145
runc version: 9c2d8d184e5da67c95d601382adf14862e4f2228
init version: 949e6fa
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.10.0-24-generic
Operating System: Ubuntu 17.04
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.54GiB
Name: rusty
ID: TMAJ:N37E:S6QE:JALC:N5WB:GXEG:TNPV:CGZP:6JYI:TRYZ:OI3S:76Y2
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support

Additional environment details (AWS, VirtualBox, physical, etc.):

Ubuntu 17.05 with systemd 232.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/loggingkind/bugBugs are bugs. The cause may or may not be known at triage time so debugging may be needed.version/17.05

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions