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 

Get Updates on the Splunk Community!

Accelerating Observability as Code with the Splunk AI Assistant

We’ve seen in previous posts what Observability as Code (OaC) is and how it’s now essential for managing ...

Integrating Splunk Search API and Quarto to Create Reproducible Investigation ...

 Splunk is More Than Just the Web Console For Digital Forensics and Incident Response (DFIR) practitioners, ...

Congratulations to the 2025-2026 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...