Splunk Search

Transaction via Rex

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

Legend

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

Legend

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

Engager

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

0 Karma

Legend

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