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!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...