access_log
Logs structured access records for each request and response.
On this page
Logs structured access records for each request and response.
Configuration
| Field | Type | Required | Description |
|---|---|---|---|
sample_rate | number | no | Fraction of requests to log (0.0, 1.0]. Defaults to 1.0. |
fields | any[] | no | Scalar field tokens; replaces the default ten when present. |
request_headers | string[] | no | Request header names allowed for request_header.<name> tokens. |
response_headers | string[] | no | Response header names allowed for response_header.<name> tokens. |
conditions | AccessLogEmitConditions | no | Emit-time conditions (AND across keys). |
conditions.min_duration_ms | integer | no | |
conditions.status_classes | (1xx | 2xx | 3xx | 4xx | 5xx)[] | no | |
conditions.paths | string[] | no |
Example
filter: access_log
sample_rate: 0.1 # optional; log ~10% of requests (default 1.0)
fields: # optional; replaces default ten fields when present
- method
- path
- status
- duration_ms
- request_header.user-agent
- trace_id
request_headers: [user-agent] # optional; pairs with request_header.* tokens
response_headers: [content-type]
conditions: # optional emit-time gates (AND across keys)
min_duration_ms: 1000
status_classes: [4xx, 5xx] # OR within list
paths: ["/api"] # OR within list; segment-boundary prefixes