Splunk Search

Remove extension from filepath in field value dynamically.

paragvidhi
Engager

I have a field in my Splunk search name filepath which contains the base path of file like below
repository/2650/document/960891_1.pdf
repository/357/document/96_1.wordx

I need to extract below string from my already existing field.
filepath value : repository/2650/document/960891_1.pdf
extract value : repository/2650/document/960891_1

filepath value : repository/357/document/96_1.wordx
extract value : repository/357/document/96_1

in short, I need to remove file extension from field value dynamically

Tags (1)
0 Karma
1 Solution

renjith_nair
Legend

@paragvidhi ,

Try

| rex field=filepath "(?<Base>.+)\.[^.]+$"

where filepath is your current field

---
What goes around comes around. If it helps, hit it with Karma 🙂

View solution in original post

renjith_nair
Legend

@paragvidhi ,

Try

| rex field=filepath "(?<Base>.+)\.[^.]+$"

where filepath is your current field

---
What goes around comes around. If it helps, hit it with Karma 🙂

paragvidhi
Engager

@renjith.nair ,
Thanks for your help it's working for me
thanks a lot

0 Karma
Get Updates on the Splunk Community!

Splunk Observability Synthetic Monitoring - Resolved Incident on Detector Alerts

We’ve discovered a bug that affected the auto-clear of Synthetic Detectors in the Splunk Synthetic Monitoring ...

Video | Tom’s Smartness Journey Continues

Remember Splunk Community member Tom Kopchak? If you caught the first episode of our Smartness interview ...

3-2-1 Go! How Fast Can You Debug Microservices with Observability Cloud?

3-2-1 Go! How Fast Can You Debug Microservices with Observability Cloud? Learn how unique features like ...