Access logging

Configuration

  1. {
  2. "access_log": [
  3. {
  4. "path": "...",
  5. "format": "...",
  6. "filter": "{...}",
  7. },
  8. ]
  9. }

path

(required, string) Path the access log is written to.

format

(optional, string) Access log format. Envoy supports custom access log formats as well as a default format.

filter

(optional, object) Filter which is used to determine if the access log needs to be written.

Filters

Envoy supports the following access log filters:

Status code

  1. {
  2. "filter": {
  3. "type": "status_code",
  4. "op": "...",
  5. "value": "...",
  6. "runtime_key": "..."
  7. }
  8. }

Filters on HTTP response/status code.

op

(required, string) Comparison operator. Currently >= and \= are the only supported operators.

value

(required, integer) Default value to compare against if runtime value is not available.

runtime_key

(optional, string) Runtime key to get value for comparision. This value is used if defined.

Duration

  1. {
  2. "filter": {
  3. "type": "duration",
  4. "op": "..",
  5. "value": "...",
  6. "runtime_key": "..."
  7. }
  8. }

Filters on total request duration in milliseconds.

op

(required, string) Comparison operator. Currently >= and \= are the only supported operators.

value

(required, integer) Default value to compare against if runtime values is not available.

runtime_key

(optional, string) Runtime key to get value for comparision. This value is used if defined.

Not health check

  1. {
  2. "filter": {
  3. "type": "not_healthcheck"
  4. }
  5. }

Filters for requests that are not health check requests. A health check request is marked by the health check filter.

Traceable

  1. {
  2. "filter": {
  3. "type": "traceable_request"
  4. }
  5. }

Filters for requests that are traceable. See the tracing overview for more information on how a request becomes traceable.

Runtime

  1. {
  2. "filter": {
  3. "type": "runtime",
  4. "key" : "..."
  5. }
  6. }

Filters for random sampling of requests. Sampling pivots on the header x-request-id being present. If x-request-id is present, the filter will consistently sample across multiple hosts based on the runtime key value and the value extracted from x-request-id. If it is missing, the filter will randomly sample based on the runtime key value.

key

(required, string) Runtime key to get the percentage of requests to be sampled. This runtime control is specified in the range 0-100 and defaults to 0.

And

  1. {
  2. "filter": {
  3. "type": "logical_and",
  4. "filters": []
  5. }
  6. }

Performs a logical “and” operation on the result of each filter in filters. Filters are evaluated sequentially and if one of them returns false, the filter returns false immediately.

Or

  1. {
  2. "filter": {
  3. "type": "logical_or",
  4. "filters": []
  5. }
  6. }

Performs a logical “or” operation on the result of each individual filter. Filters are evaluated sequentially and if one of them returns true, the filter returns true immediately.