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 APM & RUM | Upcoming Planned Maintenance

There will be planned maintenance of Splunk APM’s and Splunk RUM’s streaming infrastructure in the coming ...

Part 2: Diving Deeper With AIOps

Getting the Most Out of Event Correlation and Alert Storm Detection in Splunk IT Service Intelligence   Watch ...

User Groups | Upcoming Events!

If by chance you weren't already aware, the Splunk Community is host to numerous User Groups, organized ...