diff --git a/cmd/promxy/main.go b/cmd/promxy/main.go index a55ec8813..7ed8a5030 100644 --- a/cmd/promxy/main.go +++ b/cmd/promxy/main.go @@ -38,6 +38,7 @@ import ( "github.com/prometheus/prometheus/rules" "github.com/prometheus/prometheus/scrape" "github.com/prometheus/prometheus/storage" + promlogging "github.com/prometheus/prometheus/util/logging" "github.com/prometheus/prometheus/util/strutil" "github.com/prometheus/prometheus/web" "github.com/sirupsen/logrus" @@ -369,6 +370,22 @@ func main() { return nil }})) + // PromQL query engine reloadable + reloadables = append(reloadables, proxyconfig.WrapPromReloadable(&proxyconfig.ApplyConfigFunc{func(cfg *config.Config) error { + if cfg.GlobalConfig.QueryLogFile == "" { + engine.SetQueryLogger(nil) + return nil + } + + l, err := promlogging.NewJSONFileLogger(cfg.GlobalConfig.QueryLogFile) + if err != nil { + return err + } + engine.SetQueryLogger(l) + + return nil + }})) + // We need an empty scrape manager, simply to make the API not panic and error out scrapeManager := scrape.NewManager(nil, kitlog.With(logger, "component", "scrape manager"), nil)