Skip to content

Commit

Permalink
add missing docs for copy_fields and truncate_fields
Browse files Browse the repository at this point in the history
  • Loading branch information
kvch committed Dec 2, 2019
1 parent d4a6086 commit 5f5cf2e
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libbeat/docs/processors-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ endif::[]
ifndef::no_convert_processor[]
* <<convert,`convert`>>
endif::[]
ifndef::no_copy_fields_processor[]
* <<copy-fields, `copy_fields`>>
endif::[]
ifndef::no_decode_base64_field_processor[]
* <<decode-base64-field,`decode_base64_field`>>
endif::[]
Expand Down Expand Up @@ -86,6 +89,9 @@ endif::[]
ifndef::no_timestamp_processor[]
* <<processor-timestamp,`timestamp`>>
endif::[]
ifndef::no_truncate_fields_processor[]
* <<truncate-fields, `truncate_fields`>>
endif::[]
//# end::processors-list[]

//# tag::processors-include[]
Expand Down
38 changes: 38 additions & 0 deletions libbeat/processors/actions/docs/copy_fields.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[[copy-fields]]
=== Copy fields

The `copy_fields` processor copies a field to another one.

`fields`:: List of `from` and `to` pairs to copy from and to.
`fail_on_error`:: (Optional) If set to true, in case of an error the changes to
the event are reverted, and the original event is returned. If set to `false`,
processing continues also if an error happens. Default is `true`.
`ignore_missing`:: (Optional) Whether to ignore events which lack the source
field. The default is `false`, which will fail processing of
an event if a field is missing.

For example, this configuration:

[source,yaml]
------------------------------------------------------------------------------
processors:
- copy_fields:
fields:
- from: message
to: event.original
fail_on_error: false
ignore_missing: true
------------------------------------------------------------------------------

Copies the original `message` field to `event.original`:

[source,json]
-------------------------------------------------------------------------------
{
"message": "my-interesting-message",
"event": {
"original": "my-interesting-message"
}
}
-------------------------------------------------------------------------------

29 changes: 29 additions & 0 deletions libbeat/processors/actions/docs/truncate_fields.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[[truncate-fields]]
=== Truncate fields

The `truncate_fields` truncates a field to a given size if bigger. If the size of the field is smaller than
the limit, the field is left as is.

`fields`:: List of `from` and `to` pairs to copy from and to.
`max_bytes`:: Maximum number of bytes in a field. Mutually exclusive with `max_characters`.
`max_characters`:: Maximum number of characters in a field. Mutually exclusive with `max_bytes`.
`fail_on_error`:: (Optional) If set to true, in case of an error the changes to
the event are reverted, and the original event is returned. If set to `false`,
processing continues also if an error happens. Default is `true`.
`ignore_missing`:: (Optional) Whether to ignore events which lack the source
field. The default is `false`, which will fail processing of
an event if a field is missing.

For example, this configuration truncates the field named `message` to 5 characters:

[source,yaml]
------------------------------------------------------------------------------
processors:
- truncate_fields:
fields:
- message
max_characters: 5
fail_on_error: false
ignore_missing: true
------------------------------------------------------------------------------

0 comments on commit 5f5cf2e

Please sign in to comment.