ScriptedFilterRecord

Description:

This processor provides the ability to filter records out from FlowFiles using the user-provided script. Every record will be evaluated by the script which must return with a boolean value. Records with "true" result will be routed to the "matching" relationship in a batch. Other records will be filtered out.

Additional Details...

Tags:

record, filter, script, groovy, jython, python

Properties:

In the list below, the names of required properties appear in bold. Any other properties (not in bold) are considered optional. The table also indicates any default values, and whether a property supports the NiFi Expression Language.

Display NameAPI NameDefault ValueAllowable ValuesDescription
Record ReaderRecord ReaderController Service API:
RecordReaderFactory
Implementations: GrokReader
JsonTreeReader
WindowsEventLogReader
ReaderLookup
ParquetReader
CSVReader
Syslog5424Reader
ExcelReader
CEFReader
XMLReader
ScriptedReader
SyslogReader
JsonPathReader
AvroReader
YamlTreeReader
The Record Reader to use parsing the incoming FlowFile into Records
Record WriterRecord WriterController Service API:
RecordSetWriterFactory
Implementations: FreeFormTextRecordSetWriter
CSVRecordSetWriter
ParquetRecordSetWriter
RecordSetWriterLookup
ScriptedRecordSetWriter
XMLRecordSetWriter
JsonRecordSetWriter
AvroRecordSetWriter
The Record Writer to use for serializing Records after they have been transformed
Script LanguageScript EngineGroovy
  • Clojure
  • Groovy
  • lua
  • python
  • ruby
The Language to use for the script
Script BodyScript BodyBody of script to execute. Only one of Script File or Script Body may be used
Script FileScript FilePath to script file to execute. Only one of Script File or Script Body may be used

This property requires exactly one file to be provided..

Supports Expression Language: true (will be evaluated using variable registry only)
Module DirectoryModule DirectoryComma-separated list of paths to files and/or directories which contain modules required by the script.

This property expects a comma-separated list of resources. Each of the resources may be of any of the following types: directory, file.

Supports Expression Language: true (will be evaluated using variable registry only)

Relationships:

NameDescription
successMatching records of the original FlowFile will be routed to this relationship. If there are no matching records, no FlowFile will be routed here.
failureIn case of any issue during processing the incoming FlowFile, the incoming FlowFile will be routed to this relationship.
originalAfter successful procession, the incoming FlowFile will be transferred to this relationship. This happens regardless the number of filtered or remaining records.

Reads Attributes:

None specified.

Writes Attributes:

NameDescription
mime.typeSets the mime.type attribute to the MIME Type specified by the Record Writer
record.countThe number of records within the flow file.
record.error.messageThis attribute provides on failure the error message encountered by the Reader or Writer.

State management:

This component does not store state.

Restricted:

Required PermissionExplanation
execute codeProvides operator the ability to execute arbitrary code assuming all permissions that NiFi has.

Input requirement:

This component requires an incoming relationship.

System Resource Considerations:

None specified.

See Also:

ScriptedTransformRecord, ScriptedValidateRecord, ScriptedPartitionRecord