Remove Fields Transform

The Vector remove_fields transform accepts and outputs log events allowing you to remove one or more log fields.

Configuration

vector.toml
[transforms.my_transform_id]
type = "remove_fields" # required
inputs = ["my-source-id"] # required
fields = ["field1", "field2", "parent.child"] # required
  • booloptional

    drop_empty

    If set to true, after removing fields, remove any parent objects that are now empty.

    • Default: false
    • View examples
  • [string]commonrequired

    fields

    The log field names to drop.

    See Field Notation Syntax for more info.

    • No default
    • View examples

How It Works

Complex Processing

If you encounter limitations with the remove_fields transform then we recommend using a runtime transform. These transforms are designed for complex processing and give you the power of full programming runtime.

Environment Variables

Environment variables are supported through all of Vector's configuration. Simply add ${MY_ENV_VAR} in your Vector configuration file and the variable will be replaced before being evaluated.

You can learn more in the Environment Variables section.

Field Notation Syntax

The fields options support Vector's field notiation syntax, enabling access to root-level, nested, and array field values. For example:

vector.toml
[transforms.my_remove_fields_transform_id]
# ...
fields = ["field1", "field2", "parent.child"]
# ...

You can learn more about Vector's field notation in the field notation reference.

Nested Field Removal

Nested fields are removed in a deep fashion. They will not remove any ancestor object. For example, given the following log event:

{
"parent": {
"child1": "value1",
"child2": "value2"
}
}

And the following configuration:

[transforms.remove_nested_field]
type = "remove_fields"
fields = ["parent.child2"]

Will result in the following log event:

{
"parent": {
"child1": "value1",
}
}

Notice that parent.child1 field was preserved.