Support Questions

Find answers, ask questions, and share your expertise

Nifi RouteOnAttribute with variable attributes

New Contributor

Hello,

I have a nifi processor which is receiving data through Syslog RFC5424. When i receive data, i use ParseSyslog5424 processor in order to get all attributes. Some attributes are variables. (in bold)

 

I can get : syslog.structuredData.15C81B70@14506.os or syslog.structuredData.hzhzd@14507.os ….

 

Then, i have configured RouteOnAttribute. For the moment i hard code this :

Value : ${syslog.structuredData.15C81B70@14506.os:equals("linux69")}

Value : ${syslog.structuredData.hzhzd@14507.os:equals("windows")}

 

I would like to know if there is a way to put an expression like :

Value : ${syslog.structuredData.*.os:equals("linux69")}

 

I don't find an easy solution to do this.

 

Thanks.

2 REPLIES 2

New Contributor

find myself a solution ${anyMatchingAttribute("syslog.structuredData.*.type"):contains('esx')} !

Explorer

Hi Markushg,

 

When you want to apply condition on any number of attributes based on a pattern match. Then you may consider using anyMatchingAttribute NiFi Function.

 

Here is the link to the documentation:

https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#anyattribute

 

In your case, You may have to do something like as below:

${anyMatchingAttribute("syslog.structuredData*os"):equals('linux69')}