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!

Dashboards: Hiding charts while search is being executed and other uses for tokens

There are a couple of features of SimpleXML / Classic dashboards that can be used to enhance the user ...

Splunk Observability Cloud's AI Assistant in Action Series: Explaining Metrics and ...

This is the fourth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how ...

Brains, Bytes, and Boston: Learn from the Best at .conf25

When you think of Boston, you might picture colonial charm, world-class universities, or even the crack of a ...