Skip to content

Commit

Permalink
feat(logging): Document the dropAttributes JSON action config
Browse files Browse the repository at this point in the history
  • Loading branch information
bmcfeely committed May 8, 2024
1 parent 922663d commit 7771a9e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/content/docs/logs/ui-data/parsing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,8 @@ Note that variable names must be explicitly set and be lowercase like `%{URI:uri
my_attribute_prefix.request.headers.X-Custom: "bar"
```

You can define the list of attributes to extract with the option `keepAttributes`. For example, with the following Grok expression:
You can define the list of attributes to extract or drop with the options `keepAttributes` or `dropAttributes`.
For example, with the following Grok expression:

```
%{TIMESTAMP_ISO8601:containerTimestamp} %{GREEDYDATA:my_attribute_prefix:json({"keepAttributes": ["my_attribute_prefix.event", "my_attribute_prefix.response.headers.X-Custom"]})}
Expand All @@ -390,12 +391,13 @@ Note that variable names must be explicitly set and be lowercase like `%{URI:uri
%{TIMESTAMP_ISO8601:containerTimestamp} %{GREEDYDATA:my_attribute_prefix:json({"noPrefix": true, "keepAttributes": ["status"]})}
```

You can also configure the `json` [Grok type](#grok-syntax) using `:json(_CONFIG_)`:
To configure the `json` [Grok type](#grok-syntax), use `:json(_CONFIG_)`:

- `json({"dropOriginal": true})`: Drop the JSON snippet that was used in parsing. When set to `true` (default value), the parsing rule will drop the original JSON snippet. Note the JSON attributes will remain in the message field.
- `json({"dropOriginal": false})`: This will show the JSON payload that was extracted. When set to `false`, the full JSON-only payload will be displayed under an attribute named in `my_attribute_prefix` above. Note the JSON attributes will remain in the message field here as well giving the user 3 different views of the JSON data. If storage of all three versions is a concern it's recommended to use the default of `true` here.
- `json({"depth": 62})`: Levels of depth you want to parse the JSON value (defaulted to 62).
- `json({"keepAttributes": ["attr1", "attr2", ..., "attrN"]})`: Specifies which attributes will be extracted from the JSON. The provided list cannot be empty. If this configuration option is not set, all attributes are extracted.
- `json({"dropAttributes": ["attr1", "attr2", ..., "attrN"]})`: Specifies which attributes to be dropped from the JSON. If this configuration option is not set, no attributes are dropped.
- `json({"noPrefix": true})`: Set this option to `true` to remove the prefix from the attributes extracted from the JSON.


Expand Down

0 comments on commit 7771a9e

Please sign in to comment.