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.
Get Updates on the Splunk Community!

Observe and Secure All Apps with Splunk

 Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What's New in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...

Introduction to Splunk AI

How are you using AI in Splunk? Whether you see AI as a threat or opportunity, AI is here to stay. Lucky for ...