Splunk Search

parse and index json fields from string message

vashodha
Loves-to-Learn Lots

Hello,

I have log in the format 

"2021-02-18T16:17:12,189Z [main] INFO logname -streamstart-k1:V1,K2:V2,K3:V3,streamstop, <ADDIITONAL DATA>"  i want to parse out json elements k1:v1 etc thats between  "-streamstart" and streamstop

Labels (1)
0 Karma

b4badri
New Member

Try this

rex "streamstart(?<myvariable>(.*)(?=streamstop))"

 

0 Karma

vashodha
Loves-to-Learn Lots

it does the job but still dosent index the fields its extracted it out to the variable  can we somehow index these csv values

0 Karma

vashodha
Loves-to-Learn Lots

This gives me what i want but i am unable to index it in splunk 

(?<=streamstart-).*?(?=streamstop)

0 Karma

b4badri
New Member

Hi @vashodha 

Yes. Data extracted using rex in the search time will only be available for the search. You need to follow series of steps based on your Splunk solution for creating fields at Index time.

Please refer the below article.

Create custom fields at index time - Splunk Documentation

0 Karma
Get Updates on the Splunk Community!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...