All Apps and Add-ons

Match two field values utilizing a wildcard

jhampton_3rd
Explorer

Has anyone had to match two fields values using a wildcard in one of the fields values. 

My scenario, I have a host field that looks like this host=server1 , I have a dest field like this, dest=server1.www.me & dest=server1.xxx.com & dest=comp1.  I'm trying to find all instances where the host field with a wildcard matches the dest field.  This is the query I have so far without the filter

index="winevents" host=* | stats dc(dest) as total values(dest) count by host | search total > 1

results look like this:

host            total       values(dest)
server1          3          server1.www.me
                                      server1.xxx.com
                                      comp1

How can I filter only where the host field somewhat matches the dest field.  So results will look like this excluding the 3rd dest name of comp1.

host            total       values(dest)
server1          2          server1.www.me
                                      server1.xxx.com

I tried this but get no results

index="winevents" host=*| eval host=host + "*" | search host=dest | stats dc(dest) as total values(dest) count by host | search total > 1

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
index="winevents" host=*
| where match(dest,host) 
| stats dc(dest) as total values(dest) count by host 
| search total > 1

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
index="winevents" host=*
| where match(dest,host) 
| stats dc(dest) as total values(dest) count by host 
| search total > 1
0 Karma

jhampton_3rd
Explorer

Thanks.  Worked like a charm!!!

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...