Splunk Search

Most/More efficient way of counting incomplete transactions?

the_wolverine
Champion

I'm using events from 2 sourcetypes to determine whether a transaction is complete. Quite simply, if there are 2 events, then transaction is complete. A single event means incomplete transaction. There has got to be a better way than running a transaction and searching for eventcount=1.

0 Karma

dwaddle
SplunkTrust
SplunkTrust

What field(s) are you using in your transaction command to provide the common value that binds the transaction? If there is a combination of these fields that is entirely unique for the time range of your search, then an approach using stats might make sense, which is where both @melting and @sdaniels are headed.

If it's not that simple, and you're stuck with transaction instead of stats, then you will probably have to continue what you're doing looking for eventcount and it's probably not going to perform well. Your best optimization may be to set startswith and endswith so at least transactions get closed quickly and keeping them out of the way.

sdaniels
Splunk Employee
Splunk Employee

If you just want to know how many are incomplete couldn't you run a search like this:

... | stats count by TransactionID | where count = 1 | stats count

This should give you the overall count of transactionIDs where there is only one event in a given time range.

the_wolverine
Champion

If a transactionID existed this would be no problem. In this scenario, I would be creating the transaction from search language.

0 Karma

melting
Splunk Employee
Splunk Employee

This is doable with lookups. There is a good blog article about how to do this from Alex Raitz:
maintain state

melting
Splunk Employee
Splunk Employee

I would guess the number of transactions in the lookup is the important factor. If you only store open transactions and that number is relatively small then I would expect this to work.

0 Karma

the_wolverine
Champion

When dealing with events coming in number in the millions per day, at what point does this lookup file get out of hand?

0 Karma
Get Updates on the Splunk Community!

CX Day is Coming!

Customer Experience (CX) Day is on October 7th!! We're so excited to bring back another day full of wonderful ...

Strengthen Your Future: A Look Back at Splunk 10 Innovations and .conf25 Highlights!

The Big One: Splunk 10 is Here!  The moment many of you have been waiting for has arrived! We are thrilled to ...

Now Offering the AI Assistant Usage Dashboard in Cloud Monitoring Console

Today, we’re excited to announce the release of a brand new AI assistant usage dashboard in Cloud Monitoring ...