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!

Prove Your Splunk Prowess at .conf25—No Prereqs Required!

Your Next Big Security Credential: No Prerequisites Needed We know you’ve got the skills, and now, earning the ...

Splunk Observability Cloud's AI Assistant in Action Series: Observability as Code

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

Splunk Answers Content Calendar, July Edition I

Hello Community! Welcome to another month of Community Content Calendar series! For the month of July, we will ...