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!

Exciting News: The AppDynamics Community Joins Splunk!

Hello Splunkers,   I’d like to introduce myself—I’m Ryan, the former AppDynamics Community Manager, and I’m ...

The All New Performance Insights for Splunk

Splunk gives you amazing tools to analyze system data and make business-critical decisions, react to issues, ...

Good Sourcetype Naming

When it comes to getting data in, one of the earliest decisions made is what to use as a sourcetype. Often, ...