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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...