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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

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