Splunk Search

Matching an IP address across two sourcetypes

santorof
Path Finder

I am trying to get matching IP address's from my asset list and another device. My source1 does not have a username associated with the IP but my asset list does. I want to match the IP addresses and pull out the username in my asset list. In source1 I have a field called src_ip and in my asset list the field is IP_Address. I want to match the addresses, output one in a table or stats, along with the username pulled from an event matching the ip address from source1. Below is my attempts at trying to do this with no success.

sourcetype=Source1 | eval ip=src_ip | where ip=ip2 | table ip,dest | join ip type=inner [search sourcetype=Source_Assets earliest=-1h | eval ip2=IP_Address | table Username,ip]

sourcetype=Source1 | chart count by src_ip,dest_ip | append [search index=assets sourcetype=Source_Assets | fields Username,IP_Address | chart count by Username]

I get results for the second one but no output.

Tags (3)
0 Karma
1 Solution

lguinn2
Legend

I think you need to put your asset list into a lookup table instead of indexing it. Using a lookup will make this simple and flexible.
Here is a link to the lookup tutorial in the Splunk documentation.

If you don't want to use lookups, here is an alternative:

sourcetype=Source1 
| chart count by src_ip,dest_ip 
| join src_ip type=outer [ search index=assets sourcetype=Source_Assets 
    | fields Username,IP_Address | rename IP_Address as src_ip ]

View solution in original post

lguinn2
Legend

I think you need to put your asset list into a lookup table instead of indexing it. Using a lookup will make this simple and flexible.
Here is a link to the lookup tutorial in the Splunk documentation.

If you don't want to use lookups, here is an alternative:

sourcetype=Source1 
| chart count by src_ip,dest_ip 
| join src_ip type=outer [ search index=assets sourcetype=Source_Assets 
    | fields Username,IP_Address | rename IP_Address as src_ip ]

santorof
Path Finder

I am always trying to make more difficult then they seem haha. I took your advice and did an asset list and Splunk did all the world and correlated the correct information for me per event. Thanks!

0 Karma
Get Updates on the Splunk Community!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...