Splunk Search

How to extract filename from the path?

eduspk
Explorer

Hi All

I want to extract file name from the path

Ex:

..../../default/folder/temp.txt

output:

Filename
temp.txt

0 Karma
1 Solution

vnravikumar
Champion

Hi @eduspk

Try like and let me know

| makeresults 
| eval path="..../../default/folder/temp.txt" 
| rex field=path ".*\/(?<filename>.*)$"

View solution in original post

vnravikumar
Champion

Hi @eduspk

Try like and let me know

| makeresults 
| eval path="..../../default/folder/temp.txt" 
| rex field=path ".*\/(?<filename>.*)$"

eduspk
Explorer

Thanks for quick reply.

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