Splunk Search

How do you create a transaction out of a 500 error?

thompsonsgg
New Member

Hi,
I want to create a single transaction out of a 500 error and a specific type of error thrown immediately after the 500. I have extracted the HTTP status using a regex, but I am unsure of how to specify the 500 error in the transaction. Trying to use just the service and "500" in the starts with command is still giving me 200 status transactions.

index= 
| rex field=message ".*http.*\-\s\[.*\]\s(?[0-9\.]*)\s(?[A-Z]*)\s(?/ots[^\s]*)\s(?[\d]{3})\s(?[^\s]*).*|ErrorCode=\"(?[^\"]+).*?ErrorDescription=\"(?[^\"]+)"
| transaction startswith="ots_*Service 500" endswith="ErrorDescription"
0 Karma

kmorris_splunk
Splunk Employee
Splunk Employee

You can limit the set of events using the base search (the part before the first |). Also, the way transaction works is, it takes a field or fields as arguments to identify all events where those fields match. For example, you may want to group all of the events with the same IP Address, into a single transaction. It will need a common value in order to associate them. The startswith and endswith would be used when there are different events that are happening in a sequence, like, a login, some other stuff happens, then a logout. Another example would be parts of a transaction that could even span different event sources.

Is there a common thread between the 500 error and the error that follows it? I'm guessing IP or host or something?

0 Karma

cmerriman
Super Champion

try using eval in the startswith.

startswith=eval(ErrorCode=500)
0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

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

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...