Splunk Search

How to edit my search to determine IP Segment using a lookup?

wtaylor149
Explorer

Splunk newbie here....
Looking to determine IP Segment Name using a lookup table. I have a csv file that has three fields: from - to - segment Name. From = start of ip_range, to = last ip address in the range and segment Name is the Name for the ip_range.

In my search I have a src and that src = ip_address. So, my end result is to have the segment Name added to my results table when the src ip falls between from and to.

My search at the moment:

index=symantec sourcetype=dlp:policy_monitor | table _time id app action category src src_host dest

Current Table Results:

2015-06-10 12:00:00  46522  Endpoint HTTPS   None   SSN   1.2.3.15   my_laptop   "some_website"

My lookup file:

all_networks.csv

The contents are many but the gist of it:

from        segment Name            to
1.2.3.4     My_Local_Network     1.2.3.255

So my desired end result would be:

2015-06-10 12:00:00  46522  Endpoint HTTPS   None   SSN   1.2.3.15   my_laptop   "some_website"  "segment Name"

Thanks in advance!

Tags (4)
0 Karma

MuS
Legend

Hi wtaylor149,

take a look at this answer, where it is explained how to use a match_type = CIDR() for a lookup http://answers.splunk.com/answers/93620/lookup-with-cidr.html

cheers, MuS

jacobwilkins
Communicator

What you really need is a CIDR lookup.

Restructure your lookup to have 2 columns:

segment, segment_name
1.2.3.0/24, bob's network
1.2.4.0/24, bill's network

Then, create a lookup definition (in transforms.conf), and set match_type=cidr.

More info: http://docs.splunk.com/Documentation/Splunk/6.2.3/Knowledge/Addfieldsfromexternaldatasources

wtaylor149
Explorer

Thanks for the quick reply. I will try this today once I create all the cidr blocks in the csv file. I was being lazy and didn't want to do that. 🙂

0 Karma

MuS
Legend

HeHe, I'm too slow in the morning 🙂

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...