Splunk Search

How to extract string after particular word?

labaningombam
Explorer

Hi,

I have a line in the event like

"/v1/locations/7b-cec6-4820-b699-ec" 

I need to extract  7b-cec6-4820-b699-ec, or which ever comes after  /v1/locations/ and before a "

Please help on the same.

Thank you.

Labels (2)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this

| rex "/v1/locations/(?<field>[^\"]+)"

View solution in original post

0 Karma

vnravikumar
Champion

@labaningombam , you want to extract only after  '/v1/locations/' or any multiple conditions there?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this

| rex "/v1/locations/(?<field>[^\"]+)"
0 Karma
Get Updates on the Splunk Community!

Aligning Observability Costs with Business Value: Practical Strategies

 Join us for an engaging Tech Talk on Aligning Observability Costs with Business Value: Practical ...

Mastering Data Pipelines: Unlocking Value with Splunk

 In today's AI-driven world, organizations must balance the challenges of managing the explosion of data with ...

Splunk Up Your Game: Why It's Time to Embrace Python 3.9+ and OpenSSL 3.0

Did you know that for Splunk Enterprise 9.4, Python 3.9 is the default interpreter? This shift is not just a ...