Splunk Search

Help with regex

hank72
Path Finder

Hi community. 

Some searches have:
index="my_index"
index=my_index

I want to extract a new field named user_index but cannot figure out the regex capture group that may or may not contain quotes around the index name.

 

 

Labels (1)
0 Karma
1 Solution

hank72
Path Finder

I figured it out.

index=(\"|)(?P<user_index>[^ "]+)

 

View solution in original post

hank72
Path Finder

I figured it out.

index=(\"|)(?P<user_index>[^ "]+)

 

Get Updates on the Splunk Community!

Don't wait! Accept the Mission Possible: Splunk Adoption Challenge Now and Win ...

Attention everyone! We have exciting news to share! We are recruiting new members for the Mission Possible: ...

Unify Your SecOps with Splunk Mission Control

In today’s post, I'm excited to share some recent Splunk Mission Control innovations. With Splunk Mission ...

Data Preparation Made Easy: SPL2 for Edge Processor

By now, you may have heard the exciting news that Edge Processor, the easy-to-use Splunk data preparation tool ...