kv.asciidoc 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. [[kv-processor]]
  2. === KV processor
  3. ++++
  4. <titleabbrev>KV</titleabbrev>
  5. ++++
  6. This processor helps automatically parse messages (or specific event fields) which are of the `foo=bar` variety.
  7. For example, if you have a log message which contains `ip=1.2.3.4 error=REFUSED`, you can parse those fields automatically by configuring:
  8. [source,js]
  9. --------------------------------------------------
  10. {
  11. "kv": {
  12. "field": "message",
  13. "field_split": " ",
  14. "value_split": "="
  15. }
  16. }
  17. --------------------------------------------------
  18. // NOTCONSOLE
  19. TIP: Using the KV Processor can result in field names that you cannot control. Consider using the <<flattened>> data type instead, which maps an entire object as a single field and allows for simple searches over its contents.
  20. [[kv-options]]
  21. .KV Options
  22. [options="header"]
  23. |======
  24. | Name | Required | Default | Description
  25. | `field` | yes | - | The field to be parsed
  26. | `field_split` | yes | - | Regex pattern to use for splitting key-value pairs
  27. | `value_split` | yes | - | Regex pattern to use for splitting the key from the value within a key-value pair
  28. | `target_field` | no | `null` | The field to insert the extracted keys into. Defaults to the root of the document
  29. | `include_keys` | no | `null` | List of keys to filter and insert into document. Defaults to including all keys
  30. | `exclude_keys` | no | `null` | List of keys to exclude from document
  31. | `ignore_missing` | no | `false` | If `true` and `field` does not exist or is `null`, the processor quietly exits without modifying the document
  32. | `prefix` | no | `null` | Prefix to be added to extracted keys
  33. | `trim_key` | no | `null` | String of characters to trim from extracted keys
  34. | `trim_value` | no | `null` | String of characters to trim from extracted values
  35. | `strip_brackets` | no | `false` | If `true` strip brackets `()`, `<>`, `[]` as well as quotes `'` and `"` from extracted values
  36. include::common-options.asciidoc[]
  37. |======