Splunk Search

How to get a count of active transactions to visualize in timechart?

Path Finder

I have a transactions defined by users logging in and out.

The Goal is to have a timechart showing count of active transactions at the end of an hour or 10 minutes (total and by user)
Any ideas how to get this?

alt text

| transaction UserId startswith="login" endswith="logout" | timechart count by UserId
| transaction UserId startswith="login" endswith="logout" | timechart count

Thanks in advance

0 Karma

Path Finder

For those that came here (like me) in need for a solution, the trick I've found was to create mvfields with the span value and then mvexpand them and then do a distinct count by txid in the timechart..

So from original poster's question, lets assume we are there, and have duration in seconds created by the transaction command:

| transaction UserId startswith="login" endswith="logout"

Lets suppose that UserId is unique enough to be a TxId.

So we want to do a count of how many concurrent Tx's are at a particular timeslot of 1s:

| eval events=mvrange(0,duration,1)
| fillnull events
| mvexpand events

Now we have created on each event a # of lines with an increasing value of 1 from 0 to duration, and we are going to use that to offset each _time by that amount of seconds:

| eval _time=_time+events
| timechart dc(UserId) span=1s

And finally we do a distinct count of the TxId. 

In theory we should have and actual event per time slot to be able to to a timechart that counts active transactions by their duration.

0 Karma

New Member

I know that this doesn't directly answer the question your asking, but it is the closest I've found.  Rather than visualizing the # of active transactions, I've visualized the "cost" of the transactions which translates to the sum of the durations where they show up by start time instead of end time.

...some search that includes duration in milliseconds...
| eval _time=_time-(duration/1000) 
| timechart sum(duration) as durationSum

0 Karma


I think you want to count the concurrency of your transactions.

Path Finder

YES! that is exactly what I'm trying to do, still having troubles get it working with gentimes, eval, append and concurrency, lacking some experience.

0 Karma


Hi giovere
Try this search code And let me known if it work like you want

........| transaction UserId startswith="login" endswith="logout" | timechart  span=1h count by UserId
0 Karma

Path Finder

hello Chimell
Your solution has the same limitation as Schose's. It charts only start time of the transaction.

0 Karma



 | transaction UserId startswith="login" endswith="logout" | 
concurrency duration=duration | 
timechart max(concurrency)

... should do the job.



0 Karma

Path Finder

Thanks Andreas for the answer, your command returns for me the count of events only at the beginning of transaction. For example if I have a transaction starting at 9:00 lasting till 17:00 it would show only count 1 at 9:00 and rest is zero.

0 Karma
Get Updates on the Splunk Community!

Observability | How to Think About Instrumentation Overhead (White Paper)

Novice observability practitioners are often overly obsessed with performance. They might approach ...

Cloud Platform | Get Resiliency in the Cloud Event (Register Now!)

IDC Report: Enterprises Gain Higher Efficiency and Resiliency With Migration to Cloud  Today many enterprises ...

The Great Resilience Quest: 10th Leaderboard Update

The tenth leaderboard update (11.23-12.05) for The Great Resilience Quest is out >> As our brave ...