This repository has been archived by the owner on May 12, 2021. It is now read-only.
METRON-1533 Create KAFKA_FIND Stellar function #1025
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is built on #1024 and should not be merged until #1024 is addressed.
Changes
I created a
KAFKA_FIND
function that allows you to provide a filter expression so that only messages satisfying a condition are returned. For example...Find a message that has been enriched with geolocation data.
Find a Bro message.
The message is presented to the filter lambda expression as a map of field values. This makes creating the filter expression a bit simpler.
Like the other
KAFKA_*
functions, this is not intended to be highly performant. This is only intended to make the process of creating and modifying enrichments simpler in the REPL. See the Use Case section for more details on how I see this being used.Future
If we were in the future to provide map literals in Stellar, this would become a fair bit simpler.
Use Case
When creating enrichments, I often find that I want to validate that the enrichment I just created was successful on the live, incoming stream of telemetry. My workflow looks something like this.
Create and test the enrichment that I want to create.
That looks good to me. Now let's add that to my Bro telemetry.
It looks like that worked, but did that really work?
At this point, I would run
KAFKA_GET
as many times as it takes to retrieve a Bro message. You would just have to get lucky and hope that the enrichment worked and secondly that you would pull down a Bro message (as opposed to a different sensor).I would rather have a function that lets me only pull back the messages that I care about. In this case I could either retrieve only Bro messages.
Or I could look for messages that contain geolocation data.
Changes
Created the
KAFKA_FIND
function along with unit tests.Updated all KAFKA_* functions to use a standard
getArg
function so that argument handling is all done the same way.Pull Request Checklist