Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Apache NiFi: Put relationship name as attribute on flowfile

Solved Go to solution

Apache NiFi: Put relationship name as attribute on flowfile

Explorer

In our case we have 5 different TailFile processors as inputs and we use 5 UpdateAttribute processors to tag the flowfile comming off the TailFile processors. But this results in a crazy looking data flow with an UpdateAttribute processor for each TailFile processor.

So my idea was, to link each TailFile processors to one and the same UpdateAttribute processor, with each a different relationship name. Within the UpdateAttribute I wanted to grep the relationship name and put this as an attrbute on the flow file.

But the question is, how to get the relationship name? If this is not possible is there a more simple and manageble way to tag flow files based on the input processor (TailFile)?

Thank you.


current.png
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Apache NiFi: Put relationship name as attribute on flowfile

@Bas van de Lustgraaf

The TailFile processor adds the following attribute to each flow file it creates, tailfile.original.path = Path of the original file the flow file comes from. You could use the value of this attribute to add any additional attributes or for routing.

2 REPLIES 2

Re: Apache NiFi: Put relationship name as attribute on flowfile

@Bas van de Lustgraaf

The TailFile processor adds the following attribute to each flow file it creates, tailfile.original.path = Path of the original file the flow file comes from. You could use the value of this attribute to add any additional attributes or for routing.

Re: Apache NiFi: Put relationship name as attribute on flowfile

Explorer

@Wynner

This will work, thank you! I've linked all TailFile inputs to a single UpdateAttribute. Using the Advanced option I've created per TailFile a rule.

For TailFileSuricata:

Conditions

${tailfile.original.path:find('/var/log/suricata/.*')}

Action

  • Attribute: log.source
  • Value: suricata
Don't have an account?
Coming from Hortonworks? Activate your account here