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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...