From 36e0e57cbe4728275b8c6da415ba4f2dba89e31d Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 15 Jan 2018 17:11:05 +0100 Subject: [PATCH] Log active configuration when reloading When succesfully reloading the daemon configuration, print a message in the logs with the active configuration: INFO[2018-01-15T15:36:20.901688317Z] Got signal to reload configuration, reloading from: /etc/docker/daemon.json INFO[2018-01-14T02:23:48.782769942Z] Reloaded configuration: {"mtu":1500,"pidfile":"/var/run/docker.pid","data-root":"/var/lib/docker","exec-root":"/var/run/docker","group":"docker","deprecated-key-path":"/etc/docker/key.json","max-concurrent-downloads":3,"max-concurrent-uploads":5,"shutdown-timeout":15,"debug":true,"hosts":["unix:///var/run/docker.sock"],"log-level":"info","swarm-default-advertise-addr":"","metrics-addr":"","log-driver":"json-file","ip":"0.0.0.0","icc":true,"iptables":true,"ip-forward":true,"ip-masq":true,"userland-proxy":true,"disable-legacy-registry":true,"experimental":false,"network-control-plane-mtu":1500,"runtimes":{"runc":{"path":"docker-runc"}},"default-runtime":"runc","oom-score-adjust":-500,"default-shm-size":67108864,"default-ipc-mode":"shareable"} Signed-off-by: Sebastiaan van Stijn Upstream-commit: 8378dcf46d017c70df97d6f851e0196b113b422e Component: engine --- components/engine/daemon/config/config.go | 2 +- components/engine/daemon/reload.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/components/engine/daemon/config/config.go b/components/engine/daemon/config/config.go index e3ed530028..1466c0b71b 100644 --- a/components/engine/daemon/config/config.go +++ b/components/engine/daemon/config/config.go @@ -167,7 +167,7 @@ type CommonConfig struct { sync.Mutex // FIXME(vdemeester) This part is not that clear and is mainly dependent on cli flags // It should probably be handled outside this package. - ValuesSet map[string]interface{} + ValuesSet map[string]interface{} `json:"-"` Experimental bool `json:"experimental"` // Experimental indicates whether experimental features should be exposed or not diff --git a/components/engine/daemon/reload.go b/components/engine/daemon/reload.go index 0bbda29234..5a73c9ef92 100644 --- a/components/engine/daemon/reload.go +++ b/components/engine/daemon/reload.go @@ -27,11 +27,14 @@ func (daemon *Daemon) Reload(conf *config.Config) (err error) { attributes := map[string]string{} defer func() { + jsonString, _ := json.Marshal(daemon.configStore) + // we're unlocking here, because // LogDaemonEventWithAttributes() -> SystemInfo() -> GetAllRuntimes() // holds that lock too. daemon.configStore.Unlock() if err == nil { + logrus.Infof("Reloaded configuration: %s", jsonString) daemon.LogDaemonEventWithAttributes("reload", attributes) } }()