Splunk Search

Querying for values without a specific character?

yepyepyayyooo
New Member

Attempting to create a query that will return all values that do not have a . (dot) in their file name, meaning no file extension. Does anyone know of a way of achieving this? Seems simple but I can't figure it out. The query is a combination of terms that do have file extensions so I can't use filename!=".".

Tags (1)
0 Karma

vnravikumar
Champion

Hi

Give a try

| makeresults 
| eval file="test.txt,test1,temp.csv,test3" 
| makemv delim="," file 
| mvexpand file 
| where isnull(mvindex(split(file,"."),1))

New: Try this filters only file name

| makeresults 
| eval file="test.txt,test1,temp.csv,test3" 
| makemv delim="," file 
| mvexpand file 
| rex field=file "(?P<filename>[^.]+)"
0 Karma

harshpatel
Contributor

can you please give example list of filenames and tell us what you want to filter out?

0 Karma

yepyepyayyooo
New Member

They're unknown. Basically you have filename1.doc and filename1.txt. I'm looking to return all values that are filename1 (no file extension)

0 Karma

harshpatel
Contributor

so you want to remove file extensions and return only filenames?

0 Karma
Get Updates on the Splunk Community!

Technical Workshop Series: Splunk Data Management and SPL2 | Register here!

Hey, Splunk Community! Ready to take your data management skills to the next level? Join us for a 3-part ...

Spotting Financial Fraud in the Haystack: A Guide to Behavioral Analytics with Splunk

In today's digital financial ecosystem, security teams face an unprecedented challenge. The sheer volume of ...

Solve Problems Faster with New, Smarter AI and Integrations in Splunk Observability

Solve Problems Faster with New, Smarter AI and Integrations in Splunk Observability As businesses scale ...