Last updated
Last updated
POC code can be find on Github here:
Code contains few comments but let's explain some parts
The following line is used to create an asynchronous DataStream :
Asynchronous DataStream options/parameters are the following :
unorderedwait: with this mode, results of async functions are emitted as soon as the async requests finish. So order will maybe not conserved.
logsStreamFile: it's the source DataStream used to create the new AsyncDataSteam.
new AsyncRedisFileEnrichment(): It's the asynchronous function which wil be called for processing logic on stream.
5000, TimeUnit.MILLISECONDS: Time after an asynchronous call is declared as timed out.
setParallelism: set the parallelism for the asynchronous function.
Purpose of this code is to make asynchronous API call to get result on an IP or File hash.
Line 1: Create AsyncHttpClient
Line 2: Launch a request on Onyphe API to get result on IP address.
Line 5: Get the result of API call from Response Body.
Line 6 -11: Check if response contains results or if response is not null (In case of no more credits to call API).
Line 12-13: Call "processOnypheGetResult" function to extract relevant information from Onyphe (JSON) results and return a new JSON with fields formatted to be compliant with ECS format.
Comments this section if you want more details on specific parts of code.
This page provide link and details about POC Java code.