Update attributes based on content in NiFi

Lasitha Yapa picture Lasitha Yapa · Aug 12, 2016 · Viewed 14.5k times · Source

How can I add a attribute to the current flow file when developing an Apache NiFi cusom processor.
What I want to do is adding a new attribute (or at least update a current attribute) to the current flow file with calculated value.
Or is there an already built processor that I can use?

Answer

James picture James · Aug 12, 2016

NiFi supports several methods of creating and updating attributes, depending on the data source you wish to use. Some general purpose processors include:

UpdateAttribute - Updates attributes on flow files using both static values and NiFi's expression language.

enter image description here

You can add as many properties with one processor. I recommend scanning through the Apache NiFi Expression Language Guide to get a feel for what you can do with it.

ExtractText - The Sets attribute values by applying regular expressions to the flowfile content.

ExecuteScript - ExecuteScript Runs custom script code, which can be used to update attributes however you wish.

And there are more for particular content formats, for example: