Splunk Search

How to Extract multiple values in field in json

karthi2809
Builder

Thanks

I am trying to extract three fields in below given message

"message" : "BatchId : 7, RequestId : 100532188, Msg : Batch status to be update to SUCCESS",

 

Extract : BatchId ,RequestId ,Status need to extract SUCCESS .

 

| rex "BatchId\s*:\s*(?<batch>[^,]+),\s*RequestId\s:\s*(?<RequestID>[^,]+),\s*Msg : Batch status to be update to (?<Status>\w+)"

 

Tags (1)
0 Karma
1 Solution

isoutamo
SplunkTrust
SplunkTrust

Hi

you could try this

 

| rex "BatchId\s*:\s*(?<batch>[^,]+),\s*RequestId\s*(?<RequestID>[^,]+),\s*Msg : Batch status to be update to (?<Status>[^,]+)"

 

If this is in any other field than _raw then add into rex field=<your field name>

See https://regex101.com/r/U5IB8G/1

r. Ismo 

View solution in original post

isoutamo
SplunkTrust
SplunkTrust

Hi

you could try this

 

| rex "BatchId\s*:\s*(?<batch>[^,]+),\s*RequestId\s*(?<RequestID>[^,]+),\s*Msg : Batch status to be update to (?<Status>[^,]+)"

 

If this is in any other field than _raw then add into rex field=<your field name>

See https://regex101.com/r/U5IB8G/1

r. Ismo 

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...