Thanos supports request logging via flags.
Components are either configured using --request.logging-config-file to reference to the configuration file or --request.logging-config to provide configuration as YAML directly.
Configuration can be supplied globally, which applies to both grpc and http. Alternatively http and/or grpc can be configured independently.
Valid level for options should be one of INFO, WARNING, ERROR or DEBUG.
options:
level: ERROR
The request logging is configurable per phase via the decision.
Valid decision combinations are as follows:
options:
decision:
log_start: false
log_end: true
debug level.options:
decision:
log_start: true
log_end: true
Specifying an http block enables request logging for each endpoint.
http:
options:
level: DEBUG
decision:
log_start: true
log_end: true
The log level of the “post request” log is determined by the status code in the response.
The following mappings apply:
200 <= status code < 500 = debugstatus code > 500 = errorOptionally, additional configuration can be supplied via the config block to create an allowlist of endpoint and port combinations. Note that this feature requires an exact match if enabled.
http:
config:
- path: /api/v1/query
port: 10904
- path: /api/v1/app_range/metrics
port: 3456
Specifying a grpc block enables request logging for each service and method name combination.
grpc:
options:
level: DEBUG
decision:
log_start: true
log_end: true
The log level of the “post request” log is determined by the code in the response.
The following mappings apply:
2, 12, 13 ,15 = errordebugOptionally, additional configuration can be supplied via the config block to create an allowlist of service and method combinations. Note that this feature requires an exact match if enabled.
grpc:
config:
- service: thanos.Store
method: Info
config flags? #The following example shows how the logging config can be supplied to the sidecar component:
- args:
- sidecar
- |
--objstore.config=type: GCS
config:
bucket: <bucket>
- --prometheus.url=http://localhost:9090
- |
--request.logging-config=http:
config:
- path: /api/v1/query
port: 10904
options:
level: DEBUG
decision:
log_start: true
log_end: true
grpc:
config:
- service: thanos.Store
method: Info
options:
level: ERROR
decision:
log_start: false
log_end: true
- --tsdb.path=/prometheus-data
Note that in the above example, logs will be emitted at debug level. These logs will be filtered unless the flag --log.level=debug is set.
Found a typo, inconsistency or missing information in our docs? Help us to improve Thanos documentation by proposing a fix on GitHub here ❤️