puppetlabs / puppetlabs/puppetlabs-docker

Option to disable systemd syslog in docker::run + Document extra_systemd_parameters

Open
#809 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

community feature
Dominant language
Ruby
Stars
94
Forks
337
Avg merge
11d 15h
Merged PRs (30d)
2

Description

Use Case

A normal docker setup do not syslog container output to the systemd journal (by default container output is placed in json logfiles under /var/lib/docker/containers/*/*.log).
Only internal messages from the docker daemon itself are syslogged, not the container output.

However, the puppetlabs docker module builds a systemd service file for each continer to run, and by default, systemd syslogs all stdout and stderr for all services.
So suddently a system get double logs. First the direct json-logs in /var/lib/docker/containers/*/*.log and then the same thing is spammed to the journal, and therefore also spammed to /var/log/* (if the system is running a syslog service).

Describe the Solution You Would Like

I want an option to stop the docker::run systemd service syslogging, and only log whatever I have configured in docker, globally or in container specific options.

In docker::run you already have the options syslog_identifier and syslog_facility to tweak the syslog from the systemd service.
I would like this new extra option:
syslog_enable = true/false (default should be true, because this module has always worked this (incorrect) way)

When set to false, the /etc/systemd/system/docker-containername.service unit should get these two extra lines:

[Service]
StandardOutput=null
StandardError=null

This will mute all output from the container-service, and we're back to a "normal" setup.

Describe Alternatives You've Considered

I see there is an option extra_systemd_parameters, but it is totally undocumented.
Can/should it be used to solve the above?

In the meantime I've created this workaround:
In the profile where I docker::run my container, I've added this systemd dropin-file:

  file { '/etc/systemd/system/docker-foobar.service.d':
    ensure  => directory,
  }
  file { '/etc/systemd/system/docker-foobar.service.d/mute_output.conf':
    content => "### Managed by puppet ###\n[Service]\nStandardOutput=null\nStandardError=null\n",
    require => File['/etc/systemd/system/docker-foobar.service.d'],
  }

Oh, in any case, please document the extra_systemd_parameters option and give an example how to use it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the docker::run systemd unit generation and the existing extra_systemd_parameters entry point. Confirm how syslog_identifier and syslog_facility are handled, then add the requested option and document extra_systemd_parameters with an example; done means the generated unit can disable stdout and stderr logging and the option is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, ruby
Domain
devops, infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.