thanos-io/thanos · error
error while parsing config for request logging
Error message
error while parsing config for request logging
What it means
The rule command parses --request.logging-config via logging.ParseHTTPOptions to build HTTP request logging middleware. This wraps the parse error when the config YAML is invalid or contains unsupported fields, aborting startup because logging options are required for the HTTP servers.
Solutions
- Validate the --request.logging-config YAML: it should look like http: {log_config: {level: error}} style structure matching logging.RequestConfig.
- Fix indentation and remove unknown keys; compare against the example in Thanos docs (get_config_docs).
- Pipe the value through yamllint to catch syntax errors.
- Check the Thanos version's supported request logging schema if fields seem to be rejected.
Example fix
// before
--request.logging-config='{"level":"debug"}' # unknown top-level key
// after
--request.logging-config='{"http":{"log_config":{"level":"debug"}}}' Defensive patterns
Strategy: validation
Validate before calling
import json
def check_request_logging_config(raw):
try:
cfg = json.loads(raw)
except json.JSONDecodeError as e:
raise SystemExit(f"invalid --request.logging-config JSON: {e}")
allowed_top = {"http", "grpc"}
unknown = set(cfg) - allowed_top
if unknown:
raise SystemExit(f"unknown request logging keys: {unknown}")
for section in ("http", "grpc"):
lc = cfg.get(section, {}).get("log_config", {})
if lc and not isinstance(lc.get("level"), str):
raise SystemExit(f"{section}.log_config.level must be a string") Type guard
def is_valid_req_log_config(raw):
import json
try:
cfg = json.loads(raw)
return isinstance(cfg, dict) and set(cfg) <= {"http", "grpc"}
except (json.JSONDecodeError, AttributeError):
return False Prevention
- Copy the request logging config example from the Thanos docs for your exact version.
- Run yamllint/jsonlint on inline configs before embedding them in flags.
- Watch for field renames across Thanos versions; pin and re-check on upgrade.
- Keep the config in a file and validate it in CI instead of inlining in flags.
When it happens
Trigger: logging.ParseHTTPOptions(reqLogConfig) errors when the YAML under --request.logging-config fails to unmarshal into the RequestConfig struct (bad indentation, unknown keys like level instead of the expected fields).
Common situations: Typo in request logging config keys; YAML indentation mistakes in Helm values; copying a --log.request.level-style string where structured YAML is expected; version mismatch where a field was renamed.
Related errors
- query configuration
- error while parsing config for request logging
- getting object store config
- create syncer
- unable to unmarshal config content
AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07).
Data as JSON: /api/errors/6c657c6d711d3680.
Report an issue: GitHub.
Appendix: source
Thrown at cmd/thanos/rule.go:250
}
// Parse and check alerting configuration.
conf.alertmgrsConfigYAML, err = conf.alertmgr.configPath.Content()
if err != nil {
return err
}
if len(conf.alertmgrsConfigYAML) != 0 && len(conf.alertmgr.alertmgrURLs) != 0 {
return errors.New("--alertmanagers.url and --alertmanagers.config* parameters cannot be defined at the same time")
}
conf.alertRelabelConfigYAML, err = conf.alertmgr.alertRelabelConfigPath.Content()
if err != nil {
return err
}
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")
}
return runRule(
g,
logger,
reg,
tracer,
comp,
*conf,
reload,
getFlagsMap(cmd.Flags()),
httpLogOpts,View on GitHub (pinned to 35b8b99117)