Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promtail: force the log level on any Loki Push API target servers to match Promtail's log level. #2475

Merged
merged 2 commits into from
Aug 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pkg/promtail/promtail.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ func New(cfg config.Config, dryRun bool, opts ...Option) (*Promtail, error) {
cfg.ClientConfigs = append(cfg.ClientConfigs, cfg.ClientConfig)
}

// This is a bit crude but if the Loki Push API target is specified,
// force the log level to match the promtail log level
for i := range cfg.ScrapeConfig {
if cfg.ScrapeConfig[i].PushConfig != nil {
cfg.ScrapeConfig[i].PushConfig.Server.LogLevel = cfg.ServerConfig.LogLevel
cfg.ScrapeConfig[i].PushConfig.Server.LogFormat = cfg.ServerConfig.LogFormat
}
}

var err error
if dryRun {
promtail.client, err = client.NewLogger(promtail.logger, cfg.ClientConfigs...)
Expand Down