Skip to content

Commit

Permalink
site: document support for custom Envoy JSON Fields
Browse files Browse the repository at this point in the history
follow-up for projectcontour#3059
  • Loading branch information
Alex Standke committed Oct 28, 2020
1 parent 64d43a5 commit 3899a02
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions site/_guides/structured-logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,17 @@ To enable the feature you have two options:

## Customizing logged fields

To customize the logged fields, add a `json-fields` list of strings to your config file.
These strings must be options from the [list of valid fields][1].
If the `json-fields` key is not specified, the [default fields][2] will be configured.
Field names not in that list will be silently dropped. (This is not ideal, watch [#1507][3] for updates.)
To customize the logged fields, add a `json-fields` list of strings to your
config file. These strings must be options from the [list of valid fields][1]
or a valid key/value pair as described below. If the `json-fields` key is not
specified, the [default fields][2] will be configured.

To use Envoy supported logging operators that are not part of the list of valid
fields, or which otherwise require additional customization, they can be
specified as key/value pairs in the form `fieldName=%OPERATOR(...)%`.

Unknown field names in non key/value fields will result in validation errors, as
will unknown Envoy operators in key/value fields.

The [example config file][4] contains the full list of fields as well.

Expand All @@ -41,6 +48,7 @@ json-fields:
- "authority"
- "bytes_received"
- "bytes_sent"
- "customer_id=%REQ(X-CUSTOMER-ID)%"
- "downstream_local_address"
- "downstream_remote_address"
- "duration"
Expand Down

0 comments on commit 3899a02

Please sign in to comment.