Splunk Search

Field extraction

sandeepmakkena
Contributor

gauge="ProcessorResponse.Country[US]Processor[ApgProcessor]PaymentType[VISA] DECLINE" is one of the field.
I am trying to get Country, Processor, PaymentType and reason fields.

my search
| rex "Country[(?[^]]+)]Processor[(?[^]]+)]PaymentType[(?[^]]+)] (?[^"]+)"

I am using this but its not working, can someone help please.

Thanks for your time.

0 Karma
1 Solution

adonio
Ultra Champion

try this:

| makeresults count=1
| eval gauge="\"ProcessorResponse.Country[US]Processor[ApgProcessor]PaymentType[VISA] DECLINE\""
| rex field=gauge "\.Country\[(?<country>[^\]]+)\]Processor\[(?<processor>[^\]]+)\]PaymentType\[(?<payment_type>[^\]]+)\]\s+(?<result>[^\"]+)"

hope it helps

View solution in original post

0 Karma

vinod94
Contributor

Hi dyude @sandeepmakkena ,

You can try this ,

index=your index
|rex field=gauge "ProcessorResponse\.Country\[(?P<Country>.+)\]Processor\[(?P<Processor>.+)\]PaymentType\[(?P<PaymentType>.+)\]\s(?P<reason>\w+)"
0 Karma

adonio
Ultra Champion

try this:

| makeresults count=1
| eval gauge="\"ProcessorResponse.Country[US]Processor[ApgProcessor]PaymentType[VISA] DECLINE\""
| rex field=gauge "\.Country\[(?<country>[^\]]+)\]Processor\[(?<processor>[^\]]+)\]PaymentType\[(?<payment_type>[^\]]+)\]\s+(?<result>[^\"]+)"

hope it helps

0 Karma

sandeepmakkena
Contributor

Thank you.

0 Karma
Get Updates on the Splunk Community!

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...