thanos-io/thanos · error

getting request logging config failed.

Error message

getting request logging config failed. %v

What it means

ParseHTTPOptions reads the request-logging YAML config from an extflag.PathOrContent and wraps any failure to obtain that content with this message. It indicates the file/flag pointing at the HTTP logging config could not be read or resolved.

Solutions

  1. Check the path/flag value passed to the request logging config extflag and correct it
  2. Verify the file exists and is readable (ls -l / cat the file)
  3. If inline config is intended, pass the content via the flag's inline syntax instead of a file path
  4. Inspect the wrapped %v cause printed with the message for the underlying OS error

Example fix

// before
logOpts, err := ParseHTTPOptions(extflag.NewPathOrContentOrEmpty("bad/path.yaml"))
// after
if _, err := os.Stat("config.yaml"); err == nil {
    logOpts, err := ParseHTTPOptions(extflag.NewPathOrContent("config.yaml"))
}
Defensive patterns

Strategy: validation

Validate before calling

if p := flagValue; p != "" {
    if _, err := os.Stat(p); err != nil {
        return fmt.Errorf("request logging config not readable: %w", err)
    }
}

Prevention

When it happens

Trigger: Calling ParseHTTPOptions with a PathOrContent whose path does not exist, is unreadable, or whose --http-req-log-config style flag was passed incorrectly.

Common situations: Typo in the config file path passed on the CLI; file mounted but missing in a container; insufficient read permissions on the YAML file.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


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

Appendix: source

Thrown at pkg/logging/options.go:206

	// Insert into context (Note: This updated context isn't being used later, so this might be redundant)
	_ = middleware.NewContextWithRequestID(ctx, newReqID)

	return logFields

}

// TODO: @yashrsharma44 - To be deprecated in the next release.
func ParseHTTPOptions(reqLogConfig *extflag.PathOrContent) ([]Option, error) {
	// Default Option: No Logging.
	logOpts := []Option{WithDecider(func(_ string, _ error) Decision {
		return NoLogCall
	})}

	// If flag is incorrectly parsed.
	configYAML, err := reqLogConfig.Content()
	if err != nil {
		return logOpts, fmt.Errorf("getting request logging config failed. %v", err)
	}

	return NewHTTPOption(configYAML)
}

// TODO: @yashrsharma44 - To be deprecated in the next release.
func ParsegRPCOptions(reqLogConfig *extflag.PathOrContent) ([]grpc_logging.Option, []string, error) {
	var logOpts []grpc_logging.Option
	configYAML, err := reqLogConfig.Content()
	if err != nil {
		return logOpts, nil, fmt.Errorf("getting request logging config failed. %v", err)
	}

	logOpts, logFilterMethods, err := NewGRPCOption(configYAML)
	if err != nil {
		return logOpts, logFilterMethods, err
	}

View on GitHub (pinned to 35b8b99117)