- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Nifi RouteOnAttribute with variable attributes
- Labels:
-
Apache NiFi
Created 04-23-2020 03:15 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Created 04-23-2020 05:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
find myself a solution ${anyMatchingAttribute("syslog.structuredData.*.type"):contains('esx')} !
Created 04-26-2020 05:30 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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')}
