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!

Splunk Security Content for Threat Detection & Response, Q1 Roundup

Join Principal Threat Researcher, Michael Haag, as he walks through:An introduction to the Splunk Threat ...

Splunk Life | Happy Pride Month!

Happy Pride Month, Splunk Community! &#x1f308; In the United States, as well as many countries around the ...

SplunkTrust | Where Are They Now - Michael Uschmann

The Background Five years ago, Splunk published several videos showcasing members of the SplunkTrust to share ...