Splunk Enterprise

Help in writing regex

Deepz2612
Explorer

Hi,
I wanted to extract the words that comes after 3 back slashes as field API

Please help me in writing the regular expression

Tags (1)
0 Karma

woodcock
Esteemed Legend

Like this:

| rex field=_raw "\\{3}(?<API>\w+)"

I took you literally and I am quite sure that what you said you need is not actually what you need.

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi Deepz2612,
if you want to use the rex command, use this:

your_search
| rex "\/\w+\/\w+\/(?<my_field>.*)"
| ...

You can test it at https://regex101.com/r/EceD4t/1

Bye.
Giuseppe

kmorris_splunk
Splunk Employee
Splunk Employee

Give this a try:

\/\w+\/\w+\/(?\w+)

Check out regex101.com if you aren't familiar. It is a good place to work out / test regex against text.

Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...