Splunk Search

Only Listing Transactions with Multiple Events

epw0rrell
Path Finder

I am interested in only listing transactions of a given source entity that contain multiple events.  Is there a quick and easy way to do this?

index=main | transaction src_entity startswith=at least one thing endswith=another thing | table src dst etc.

Labels (1)
0 Karma
1 Solution

bowesmana
SplunkTrust
SplunkTrust

To count multiple values of fields, use mvcount, i.e.

| where mvcount(fieldname)>1

 and a 'value' in the field will be the set of distinct values found for that field in the transaction, e.g. see this simple example

| makeresults count=20
| streamstats c
| eval _time=_time-c
| sort - _time
| eval id2=ceil(c/2)
| eval id3=random() % 5
| eval id=if(c<9,"123","456")
| transaction id
| eval c_id2=mvcount(id2), c_id3=mvcount(id3)

View solution in original post

epw0rrell
Path Finder

Work perfect thanks!!

0 Karma

epw0rrell
Path Finder

Thanks, that is definitely the answer to that question but now looking at the results, I see that I need to be more specific and only display transactions where a certain field has more than one "event" value if that makes sense?  Thanks for your help and is there a way I can do this? 

0 Karma

bowesmana
SplunkTrust
SplunkTrust

To count multiple values of fields, use mvcount, i.e.

| where mvcount(fieldname)>1

 and a 'value' in the field will be the set of distinct values found for that field in the transaction, e.g. see this simple example

| makeresults count=20
| streamstats c
| eval _time=_time-c
| sort - _time
| eval id2=ceil(c/2)
| eval id3=random() % 5
| eval id=if(c<9,"123","456")
| transaction id
| eval c_id2=mvcount(id2), c_id3=mvcount(id3)

bowesmana
SplunkTrust
SplunkTrust

If you're just looking for number of events that make up the transaction, then the transaction command adds a field called eventcount to each of the results, so you can just do

| where eventcount>1

Please note that transaction command has a number of issues when dealing with large data sets or long running spans between connected events and you will not see errors when using the command, only 'odd' things happening and random behaviour.

transaction has its uses, but often the same can be achieved with the stats command

 

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Event Series May & June: From Network Visibility to Service Intelligence

Unifying the Network: Moving from Alert Noise to Service Intelligence with Splunk ITSI In today’s hybrid ...

Global Splunk User Group Events: May + June 2026

Your Splunk Community Awaits: Discover Upcoming User Group Events Worldwide    Staying ahead in the fast-paced ...

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...