Bug 56130 - incompatible defaults in UCR template daemon.json
incompatible defaults in UCR template daemon.json
Status: NEW
Product: UCS
Classification: Unclassified
Component: Docker
UCS 5.2
Other Linux
: P5 normal (vote)
: UCS 5.2
Assigned To: App Center maintainers
App Center maintainers
https://git.knut.univention.de/univen...
:
Depends on:
Blocks: 56058
  Show dependency treegraph
 
Reported: 2023-06-09 08:23 CEST by Daniel Tröder
Modified: 2024-03-28 09:08 CET (History)
0 users

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 3: Simply Wrong: The implementation doesn't match the docu
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.069
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Tröder univentionstaff 2023-06-09 08:23:28 CEST
Currently, two options for the logging driver (below the "log-opts" key) are hard-coded into /etc/docker/daemon.json. Those options are however not compatible with all logging drivers:

-----------------------------------------------------------------------------
# cat /etc/docker/daemon.json 
{
    "bip": "172.17.42.1/16",
    "live-restore": true,
    "log-driver": "json-file",
    "log-opts": {
        "max-file": "4",
        "max-size": "10m"
    }
}

# ucr set docker/daemon/default/opts/log-driver=journald
# cat /etc/docker/daemon.json 
{
    "bip": "172.17.42.1/16",
    "live-restore": true,
    "log-driver": "journald",
    "log-opts": {
        "max-file": "4",
        "max-size": "10m"
    }
}

# systemctl restart docker.service 
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.

# grep max-file /var/log/syslog
Jun  9 08:02:40 self-disclosure1 dockerd[19391]: failed to start daemon: failed to set log opts: unknown log opt 'max-file' for journald log driver
Jun  9 08:02:42 self-disclosure1 dockerd[19404]: failed to start daemon: failed to set log opts: unknown log opt 'max-file' for journald log driver

-----------------------------------------------------------------------------


I wrote a patch for the UCR template that enables "log-opts" according to the documentation of each logging driver:


-----------------------------------------------------------------------------

# ucr set docker/daemon/default/opts/log-driver=json-file
# cat /etc/docker/daemon.json 
{
    "bip": "172.17.42.1/16",
    "live-restore": true,
    "log-driver": "json-file",
    "log-opts": {
        "env": "DOCKER_HOST_NAME",
        "labels": "APP_NAME,APP_VERSION,UCS",
        "max-file": "4",
        "max-size": "10m",
        "tag": "{{.ImageName}}/{{.Name}}/{{.ID}}"
    }
}

# systemctl restart docker.service && echo OK
OK

# ucr set docker/daemon/default/opts/log-driver=journald
# cat /etc/docker/daemon.json 
{
    "bip": "172.17.42.1/16",
    "live-restore": true,
    "log-driver": "journald",
    "log-opts": {
        "env": "DOCKER_HOST_NAME",
        "labels": "APP_NAME,APP_VERSION,UCS",
        "tag": "{{.ImageName}}/{{.Name}}/{{.ID}}"
    }
}

# systemctl restart docker.service && echo OK
OK

# ucr set docker/daemon/default/opts/log-driver=fluentd
# cat /etc/docker/daemon.json 
{
    "bip": "172.17.42.1/16",
    "live-restore": true,
    "log-driver": "fluentd",
    "log-opts": {
        "env": "DOCKER_HOST_NAME",
        "fluentd-address": "unix:///var/run/fluentd.sock",
        "fluentd-sub-second-precision": "true",
        "labels": "APP_NAME,APP_VERSION,UCS",
        "tag": "docker-logs"
    }
}

# systemctl restart docker.service && echo OK
OK


-----------------------------------------------------------------------------

The ["log-opts"]["labels"] configuration is meant to work with Bug <to-be-created>.
Comment 1 Daniel Tröder univentionstaff 2023-06-09 08:32:04 CEST
The ["log-opts"]["labels"] configuration is meant to work with Bug #56131.

The MR is: https://git.knut.univention.de/univention/ucs/-/merge_requests/782
Comment 3 Daniel Tröder univentionstaff 2024-03-28 09:08:11 CET
IMHO, this should be implemented for the 5.2-0 release, because the change requires a restart of the Docker daemon to take effect. Something we should not do in an errata release.