kv.asciidoc 2.0 KB

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