Splunk Search

Combine Like Fields from Sourcetypes in the Same Index

atebysandwich
Path Finder

I have two sourcetypes from the same index, both in JSON formatting.  One contains hosts and vulnerability scan data and the other contains hosts and host info. I ultimately want to tie the vulnerability data to the the hosts in the other sourcetype and create an outputlookup.

The matching field I would like to use is IP but the field names are different in each sourcetype. Sourcetype1 has the IP field named ipv4s{} and sourcetype2's IP field is called asset.ivp4. I have tried combing them using eval and coalesce but when I do, ipv4s{} will come up as the field value and not the IPs of the two previously mentioned fields. 

Here is the search I've been trying:

 

 

 

index=index (sourcetype=sourcetype1 OR sourcetype=sourcetype2
| eval IP=coalesce("ipv4s{}","asset.ipv4")

 

 

 

 

Labels (4)
0 Karma

yuanliu
SplunkTrust
SplunkTrust

The big secret is quotation marks.

index=index (sourcetype=sourcetype1 OR sourcetype=sourcetype2
| eval IP=coalesce('ipv4s{}','asset.ipv4')

isoutamo
SplunkTrust
SplunkTrust

In splunk ” means value and ‘ means field name.

Get Updates on the Splunk Community!

Upcoming Webinar: Unmasking Insider Threats with Slunk Enterprise Security’s UEBA

Join us on Wed, Dec 10. at 10AM PST / 1PM EST for a live webinar and demo with Splunk experts! Discover how ...

.conf25 technical session recap of Observability for Gen AI: Monitoring LLM ...

If you’re unfamiliar, .conf is Splunk’s premier event where the Splunk community, customers, partners, and ...

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...