Splunk Search

How to search start dot whatever?

summitsplunk
Communicator

If I wanted everything with a .wav extension returned how would I format this?

index="myindex" AttCnt=* AttNames=* AttSize=* | stats count by AttNames | where AttNames="*.wav"

0 Karma
1 Solution

elliotproebstel
Champion

The answer above from @kmaron is technically correct, but your search will be more efficient if you move the desired spec into the base of the search. I'd recommend this:

index="myindex" AttCnt=* AttNames="*.wav" AttSize=* 
| stats count by AttNames

View solution in original post

elliotproebstel
Champion

The answer above from @kmaron is technically correct, but your search will be more efficient if you move the desired spec into the base of the search. I'd recommend this:

index="myindex" AttCnt=* AttNames="*.wav" AttSize=* 
| stats count by AttNames

niketn
Legend

Actually @elliotproebstal while your answer and approach is correct I am afraid @kmaron 's query is not. Following with where would work, however best approach is to filter required results upfront if possible like you have suggested.

<baseSearch>
| where AttNames like("%.wav")

Run anywhere test queries
Only if AttNames is actually "*.wav" where will work. If AttNames changes to something like "test.wav" it will not.

| makeresults
| eval AttNames="*.wav"
| where AttNames="*.wav"

Correct query with like()

| makeresults
| eval AttNames="test.wav"
| where AttNames like("%.wav")
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

elliotproebstel
Champion

Ahh, good clarification, @niketnilay. Thanks!

0 Karma

niketn
Legend

Anytime @elliotproebstel... But I can't figure out why I always misspell your name 😉

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

elliotproebstel
Champion

I inserted a script into your browser to randomize how you spell my name. 🙂

0 Karma

kmaron
Motivator

I was focused on the wildcard not the where part. Sorry.

niketn
Legend

@kmaron, no need to be sorry, you are trying to help out your mates here 😉 We all get fixated on some things from time to time. We error out and then correct it.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

summitsplunk
Communicator

I thought @kmaron way would work but when I do that:

index="myindex" AttCnt= AttNames= AttSize= | stats count by AttNames | where AttNames="*.wav"

I get no results whereas when I do it your way I get results.

Its odd, but thank you

0 Karma

kmaron
Motivator
where AttNames="*.wav"

If you put a * in front of the .wav you'll get anything that ends with .wav

0 Karma

kmaron
Motivator

please disregard this comment. It's wrong.

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 ...