thanos-io/thanos · error

error while parsing config for request logging

Error message

error while parsing config for request logging

What it means

The query command parses the request logging config file (--request-log-config) via logging.ParseHTTPOptions; a parse failure is wrapped as "error while parsing config for request logging". It means the YAML content does not match the expected HTTP logging options schema.

Solutions

  1. Validate the YAML against the documented HTTP request-log options schema (list of options with status codes/duration/time).
  2. Check file path and content: ensure --request-log-config points to the intended file and it is non-empty.
  3. Fix YAML indentation/types; remove unknown fields.
  4. Use the schema-compatible example from the Thanos docs for your version.

Example fix

// before (invalid)
http:
  - status_codes
// after
options:
  - duration
  - status_codes
  - time
Defensive patterns

Strategy: validation

Validate before calling

// Validate request-log config before deploy
var opts logging.HTTPOptions
if err := yaml.UnmarshalStrict(configBytes, &opts); err != nil {
    return fmt.Errorf("invalid http request-log config: %w", err)
}

Try / catch

_, err := logging.ParseHTTPOptions(cfgPath)
if err != nil {
    return fmt.Errorf("request log config rejected: %w", err)
}

Prevention

When it happens

Trigger: Passing a --request-log-config file whose YAML has unknown fields, wrong types (e.g. a string where a list is expected), or invalid structure that ParseHTTPOptions cannot decode.

Common situations: Hand-edited logging config with indentation errors, copied config from a different component version with changed schema, or pointing the flag at a config written for gRPC options only.

Related errors


AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07). Data as JSON: /api/errors/0307a19d63471817. Report an issue: GitHub.

Appendix: source

Thrown at cmd/thanos/query.go:243

		for _, feature := range *featureList {
			if feature == promqlExperimentalFunctions {
				parser.EnableExperimentalFunctions = true
				level.Info(logger).Log("msg", "Experimental PromQL functions enabled.", "option", promqlExperimentalFunctions)
			}
			if feature == promqlAtModifier {
				level.Warn(logger).Log("msg", "This option for --enable-feature is now permanently enabled and therefore a no-op.", "option", promqlAtModifier)
			}
			if feature == promqlNegativeOffset {
				level.Warn(logger).Log("msg", "This option for --enable-feature is now permanently enabled and therefore a no-op.", "option", promqlNegativeOffset)
			}
			if feature == queryPushdown {
				level.Warn(logger).Log("msg", "This option for --enable-feature is now permanently deprecated and therefore ignored.", "option", queryPushdown)
			}
		}

		httpLogOpts, err := logging.ParseHTTPOptions(reqLogConfig)
		if err != nil {
			return errors.Wrap(err, "error while parsing config for request logging")
		}

		grpcLogOpts, logFilterMethods, err := logging.ParsegRPCOptions(reqLogConfig)
		if err != nil {
			return errors.Wrap(err, "error while parsing config for request logging")
		}

		if *webRoutePrefix == "" {
			*webRoutePrefix = *webExternalPrefix
		}

		if *webRoutePrefix != *webExternalPrefix {
			level.Warn(logger).Log("msg", "different values for --web.route-prefix and --web.external-prefix detected, web UI may not work without a reverse-proxy.")
		}

		tsdbRelabelConfig, err := storeSelectorRelabelConf.Content()
		if err != nil {
			return errors.Wrap(err, "error while parsing tsdb selector configuration")

View on GitHub (pinned to 35b8b99117)