Skip to main content

FilterAttribute

Description

Filters the attributes of a FlowFile by retaining specified attributes and removing the rest or by removing specified attributes and retaining the rest.

Tags

Attribute Expression Language, attributes, delete, filter, modification, regex, regular expression, remove, retain

Properties

In the list below required Properties are shown with an asterisk (*). Other properties are considered optional. The table also indicates any default values, and whether a property supports the NiFi Expression Language.

Display NameAPI NameDefault ValueAllowable ValuesDescription
Filter Mode *Filter ModeRetain
  • Retain
  • Remove
Specifies the strategy to apply on filtered attributes. Either 'Remove' or 'Retain' only the matching attributes.
Attribute Matching Strategy *Attribute Matching StrategyEnumerate attributes
  • Enumerate attributes
  • Use regular expression
Specifies the strategy to filter attributes by.
Filtered Attributes *Filtered AttributesA set of attribute names to filter from FlowFiles. Each attribute name is separated by the comma delimiter ','.

Supports Expression Language, using FlowFile attributes and Environment variables.

This property is only considered if:
  • the property Attribute Matching Strategy has a value of Enumerate attributes
Filtered Attributes Pattern *Filtered Attributes PatternA regular expression to match names of attributes to filter from FlowFiles.

Supports Expression Language, using FlowFile attributes and Environment variables.

This property is only considered if:
  • the property Attribute Matching Strategy has a value of Use regular expression

Dynamic Properties

This component does not support dynamic properties.

Relationships

NameDescription
successAll successful FlowFiles are routed to this relationship

Reads Attributes

This processor does not read attributes.

Writes Attributes

This processor does not write attributes.

State Management

This component does not store state.

Restricted

This component is not restricted.

Input Requirement

This component requires an incoming relationship.

Example Use Cases

Use Case 1

Retain all FlowFile attributes matching a regular expression

Configuration

Set "Filter Mode" to "Retain".
Set "Attribute Matching Strategy" to "Use regular expression".
Specify the "Filtered Attributes Pattern", e.g. "my-property|a-prefix[.].*".

Use Case 2

Remove only a specified set of FlowFile attributes

Configuration

Set "Filter Mode" to "Remove".
Set "Attribute Matching Strategy" to "Enumerate attributes".
Specify the set of "Filtered Attributes" using the delimiter comma ',', e.g. "my-property,other,filename".

System Resource Considerations

This component does not specify system resource considerations.

See Also