Splunk Search

How to extract filename from the path?

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

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

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

Explorer

Thanks for quick reply.

0 Karma