Splunk Search

Transaction via Rex

jasoneaton
Engager

I have a query that I'm trying to get the amount of time a transaction takes to execute. I was selecting only a piece of the transaction but it does have a transaction id in the data.

This query returns results, "process start" OR "process end". Then i use Rex to grab the transaction id which also returns results, | rex field=_raw "Correlation Id: \[(?<correlation_id>.*)\] "

Next step add transaction to this so it correlates the whole transaction ... this is where it fails the transaction addition doesn't return any results. I'm sure something is wrong with my query. 

| transaction correlation_id _raw startswith="process start" endswith="process end"

Can you use transaction on a generated Rex result? Thanks in advance.

Labels (2)
Tags (1)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @jasoneaton,

why don't you try to use stats instead transaction?

something like this:

your_search ("process start" OR "process end")
| rex field=_raw "Correlation Id: \[(?<correlation_id>.*)\] "
| stats earliest(_time) AS start latest(_time) AS end BY ID
| eval duration=end-start

About the regex, if you share a sample of your logs I can help you.

Ciao.

Giuseppe

View solution in original post

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @jasoneaton,

why don't you try to use stats instead transaction?

something like this:

your_search ("process start" OR "process end")
| rex field=_raw "Correlation Id: \[(?<correlation_id>.*)\] "
| stats earliest(_time) AS start latest(_time) AS end BY ID
| eval duration=end-start

About the regex, if you share a sample of your logs I can help you.

Ciao.

Giuseppe

0 Karma

jasoneaton
Engager

Thank you Giuseppe! That is very helpful and accomplishes what I am trying to do 🙂

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @jasoneaton,

the important thing is to understand the approach different than DB approach that all of us have before using Splunk.

Happy Splunking.

Ciao and next time.

Giuseppe

P.S.: Karma Points are appreciated 😉

0 Karma
Get Updates on the Splunk Community!

Combine Multiline Logs into a Single Event with SOCK - a Guide for Advanced Users

This article is the continuation of the “Combine multiline logs into a single event with SOCK - a step-by-step ...

Everything Community at .conf24!

You may have seen mention of the .conf Community Zone 'round these parts and found yourself wondering what ...

Index This | I’m short for "configuration file.” What am I?

May 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with a Special ...