Splunk Search

How to extract a field in using regex?

man03359
Communicator

I am relatively new to Splunk and I am trying to extracting fields in Splunk, 

I have a pattern I am attempting to extract and put into a field. The pattern looks like this:

AdyenPaymentResponse::ProcessResponse::Response -> Result : Failure
AdyenPaymentResponse::ProcessResponse::Response -> Result : Success

I am using this expression to match the pattern:

| rex field=_raw "AdyenPaymentResponse:.*\sResult\s:(?<Status>)"

I have to keep "AdyenPaymentResponse" as the base search and  I would like to extract this into a field called "Status" which shows only Failure or Success 

 

 

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Add the ".+" inside the brackets after <status>

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

What is the question as this looks like it should work (although, depending on your data, you might want to use these slight modifications)

| rex field=_raw "AdyenPaymentResponse:.+\sResult\s:\s(?<Status>)"

Strictly speaking, you don't need field=_raw as this is the default field for rex

0 Karma

man03359
Communicator

It is not creating a field, the regex I am using

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

You are right, I missed it too. You need to specify the pattern you want to be in the field

| rex field=_raw "AdyenPaymentResponse:.+\sResult\s:\s(?<Status>.+)"
0 Karma

man03359
Communicator

What should I modify exactly?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Add the ".+" inside the brackets after <status>

0 Karma

man03359
Communicator

Thanks a lot 🙂 It worked 🙂 🙂

0 Karma
Get Updates on the Splunk Community!

Say goodbye to manually analyzing phishing and malware threats with Splunk Attack ...

In today’s evolving threat landscape, we understand you’re constantly bombarded with phishing and malware ...

AppDynamics is now part of Splunk Ideas

Hello Splunkers, We have exciting news for you! AppDynamics has been added to the Splunk Ideas Portal. Which ...

Advanced Splunk Data Management Strategies

Join us on Wednesday, May 14, 2025, at 11 AM PDT / 2 PM EDT for an exclusive Tech Talk that delves into ...