Splunk Search

How to write Host_regex to extract filename from the source path

deepthi5
Path Finder

Hi Team

I have file names C:\SPLUNKCEBU\rdilraanan010-4-1.ncr.com.Gi0-2.csv

from which i need host_regex to take only the name of the file ex: rdilraanan010-4-1.ncr.com.Gi0-2 No path and no extension
Right now i have got a host_regex =(?\w+-\d+-\d) like this but this extracts only till rdilraanan010-4-1 which is not my desired output

can any one help

Thanks and Regards,
Deepthi Bulusu.

Tags (2)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

This worked for me using your example on regex101.com

"(?<filename>[\w-\d\.]+)\.\w"
---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

This worked for me using your example on regex101.com

"(?<filename>[\w-\d\.]+)\.\w"
---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

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