This is a User Defined Function for Apache Nifi
This is an Apache Nifi Processor for parsing User Agent Strings.
You can get the prebuilt NAR file from maven central.
If you use a maven based project simply add this dependency
<dependency> <groupId>nl.basjes.parse.useragent</groupId> <artifactId>yauaa-nifi</artifactId> <type>nar</type> <version>7.22.0</version> </dependency>
To install this function put the nar file in the
cp ./udfs/nifi/nifi-nar/target/yauaa-nifi-<version>.nar <nifi-path>/lib
Make sure you replace
<nifi-path> with your actual path to your nifi installation.
After you have added this nar file you will find the ParseUserAgent processor in the list.
First you make sure that the FlowFile going into this processor has the attributes needed as input.
In the configuration specify which attributes contain the values of the Request Headers that were logged. The only mandatory one is
RequestHeader.UserAgent. The other properties refer to the original User-Agent Client Hints request header names.
In the configuration enable the fields you need for analysis. By default none have been selected.
The output FlowFile will now have additional attributes for all of the selected attributes that are named Useragent.SelectedField.
Key: 'Useragent.DeviceClass' Value: 'Phone' Key: 'Useragent.OperatingSystemNameVersion' Value: 'Android 4.1.2'
In this log example the
XXsomethingXX attributes are the input values and the
Useragent.something are the outputs: