Splunk Search

How to Use Field Values in Endswith Parameter of Transactions

Traer001
Path Finder

Hello!

I am trying to group my log entries based on very specific criteria but can't seem to figure out how to do so.

I have logs like this:

2021-04-23 16:47:26  User Id: 6211 Error Resolved

2021-04-23 16:47:25  Error[0] type 800

2021-04-23 16:47:25  User Id: 2345 Error Resolved

2021-04-23 16:47:23  Error[0] Error Response {"user_id":2345, "error_id":9101, ..............etc}

2021-04-23 16:47:23  Error[0] type 800

2021-04-23 16:47:22  Error[0] Error Response {"user_id":6211, "error_id":9100, ..............etc}

2021-04-23 16:47:22  Error[0] type 800

 

I am trying to get three events in my transactions: (1) the initial error type message, (2) the error response details, and (3) the error resolved message. However, I need the error response details and the error resolved message to contain the same user id. I currently have my query set up like this:

index=INDEX host=HOSTNAME sourcetype=SOURCETYPE
| rex field=_raw "Error\[0\]\stype\s(?<error_code>\d+)"
| rex field=_raw "User\sId:(?<user_id>\d+)\sError\sResolved"
| rex field=_raw "Error\[0\]\sError\sResponse\s{\"user_id\":(?<user_id>\d+)"
| where user_id<20000 or error_code=800
| transaction startswith="Error[0] type 800" endswith="User Id:"

 

I'm lost on how to make sure that the transaction retrieves only the events where the user id of the error response details matches the error resolved message. Any ideas?

Labels (2)
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...