// mergeLogConfig merges the daemon log config to the container's log config if the container's log driver is not specified. func (daemon *Daemon) mergeAndVerifyLogConfig(cfg *containertypes.LogConfig) error { if cfg.Type == "" { cfg.Type = daemon.defaultLogConfig.Type } if cfg.Config == nil { cfg.Config = make(map[string]string) } if cfg.Type == daemon.defaultLogConfig.Type { for k, v := range daemon.defaultLogConfig.Config { if _, ok := cfg.Config[k]; !ok { cfg.Config[k] = v } } } return logger.ValidateLogOpts(cfg.Type, cfg.Config) }
// getLogConfig returns the log configuration for the container. func (daemon *Daemon) getLogConfig(cfg containertypes.LogConfig) containertypes.LogConfig { if cfg.Type != "" || len(cfg.Config) > 0 { // container has log driver configured if cfg.Type == "" { cfg.Type = jsonfilelog.Name } return cfg } // Use daemon's default log config for containers return daemon.defaultLogConfig }