CIDR Lookup
Before we can configure the Lookup table, we need to extract the correct fields.
Parse the Events
In our previous challenge, we used the Regex Extract Function. But, because our new data follows a standard structure – in this case, CSV – we can use one of Cribl Stream's most powerful Functions: Parser.
- With
Manageactive in Stream's top nav, click through toProcessing > Pipelines. - If necessary, refresh the right pane by clicking
Sample Data, then clickingSimplenext to the newnetflow_sample.csvsample file. - Click the
Add Pipelinebutton, then selectCreate Pipeline. - In the new Pipeline's
IDfield, entercidr_lookup. - Click
Save. - Click
Add Functiononand selectStandard>Parser. - Make sure the new Function's
Typeis set toCSV.` - In the
List of Fields, paste:StartTime,Dur,Proto,SrcAddr,Sport,Dir,DstAddr,Dport,State,sTos,dTos,TotPkts,TotBytes,SrcBytes,Label - Your interface should now look like this (click to enlarge):

- Click
Save.
The Parser Function has split each event based on the CSV type. To the resulting fields, it has then applied the field names you pasted in.
Create the Lookup Table
Now we're ready to create the Lookup table.
-
Select the
Processingsubmenu in the top nav and clickKnowledge.Note: Depending on the size of your window, the top nav will consolidate items that won't fit in a pulldown represented by an ellipsis (
...) - if so, click on the ellipsis and then selectProcessingand click onKnowledge. -
If
Lookupsis not already selected in the left sidebar, click to select it. -
At the upper right, click
Add Lookup File, then selectCreate with Text Editor. -
Copy this text to the clipboard:
cidr,team
192.168.0.0/26,TeamA
192.168.0.64/26,TeamB
192.168.0.128/26,TeamC
192.168.0.192/26,TeamDThis Lookup table lists the four subnets and each subnet's associated team.
-
Paste the clipboard contents into large text field.
-
Type or paste
cidr_lookup.csvinto theFilenamefield. Your interface should now look like this (click to enlarge):
-
Click
Save.
Configure the Lookup
Now, we are ready to configure the Lookup Function.
- Select the
Processingsubmenu in Stream's top nav and clickPipelines. - Choose the
cidr_lookupPipeline from the list of Pipelines on the left. - As before, in the right pane, click
Simplenext to thenetflow_sample.csvsample. - To add the Lookup Function to the Pipeline, click
Add Functionon, thenStandard, thenLookup. - Configure the Function to match this screenshot (click to enlarge):

- Click
Save. - In the right Preview pane, toggle between
INandOUT. When selectingOUT, you should see the lookup values added to each event.
Send to Correct Index
Now we can use the value of the new team field to send the data to the correct index. We'll use the same Eval method we used in the last scenario.
- Make sure Stream's left pane still displays the
cidr_lookupPipeline. - In the right pane, make sure the
Preview Simpletab still has focus, displaying events from yournetflow_sample.csvsample. - To add the
EvalFunction, clickAdd Functionon, thenStandard, thenEval. - Scroll down and click into your new
EvalFunction. - Configure the Function to match this screenshot (click to enlarge):

- Click
Save. - In the right Preview pane, toggle between
INandOUT. When selectingOUT, you should see the new index values added to each event.
Note that we're setting the index value to team_src. Since team_src is not in quotes, it is not a literal – it refers to the value of the team_src field for each event. (If team_src had single quotes around it, like 'team_src', it would set each index value to the literal string 'team_src'.)
Drop Non-Team Events
To complete this scenario, our customer wanted to filter out events that were not sent by any of their teams. For this, we used the Drop Function to filter out events without the team_src field.
- Make sure Stream's left pane still displays the
cidr_lookupPipeline. - As before, in the right pane, make sure the
Preview Simpletab still has focus, displaying events from yournetflow_sample.csvsample. - To add the
DropFunction, clickAdd Functionon, thenStandard, thenDrop. - Scroll down and click into your new
DropFunction'sFilterfield. - As shown below (click to enlarge), replace the
Filterfield's defaulttruevalue with:!team_src
- Click
Save.
Note that we've used the simple JavaScript filter !team_src to filter out events that do not contain a team_src field, meaning that these events were not sent by one of the four enumerated teams.