Splunk Search

Write a request

gitingua
Communicator

Need help writing a request

file1.csv 

usernamesrc_ip
John192.168.16.35
Smith172.167.3.43
Aram132.56.23.3

 

file2.csv

IP addressASNOther
192.168.16.0/241234RU
172.167.3.0/244321AG
132.56.23.0/246789BR

 

output 

usernamesrc_ipasnother
John192.168.16.351234RU
Smith172.167.3.434321AG
Aram132.56.23.36789BR

 

 

Thanks guys !!!!

Labels (4)
0 Karma
1 Solution

nmohammed
Builder

file1.csv -- > csv based lookup

file2.csv -->  cidr based lookup (I've renamed "IP Address" field to ip_address) 

Add a new lookup definition, name it "file2"  and select file2.csv

Check on advanced options.  In "Match type"  type in "CIDR(ip_address)" .

nmohammed_0-1634776466572.png

 

| inputlookup file1.csv 
| fields src_ip, username
| lookup file2 "ip_address" as src_ip output ASN, Other

 

View solution in original post

nmohammed
Builder

Hi @gitingua 

 

try this out, assuming you've these files uploaded as lookups

 

 

| inputlookup file1.csv 
| appendcols 
    [inputlookup file2.csv 
    |  fields ASN,Other ]
| table username,src_ip,ASN,Other

 

0 Karma

gitingua
Communicator

@nmohammed 

No no no no. 

if the first three src_ip values match the IP address. then takes on these values

if src_ip(192.168.16.35) = IP address(192.168.16.0/24)

 

0 Karma

nmohammed
Builder

file1.csv -- > csv based lookup

file2.csv -->  cidr based lookup (I've renamed "IP Address" field to ip_address) 

Add a new lookup definition, name it "file2"  and select file2.csv

Check on advanced options.  In "Match type"  type in "CIDR(ip_address)" .

nmohammed_0-1634776466572.png

 

| inputlookup file1.csv 
| fields src_ip, username
| lookup file2 "ip_address" as src_ip output ASN, Other

 

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...