Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Apache NiFi: Put relationship name as attribute on flowfile

avatar
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

avatar
@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.

View solution in original post

2 REPLIES 2

avatar
@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.

avatar
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