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!

Splunk App Dev Quarterly Roundup: AI, Agents, and Innovation!

Another quarter, another wave of innovation. From complex integrations to pushing the limits ...

Federated Search for Dynamic Data Self Storage Is Now Generally Available on Splunk ...

 Splunk is excited to announce the General Availability of Federated Search for Dynamic Data Self Storage ...

Index This | What has many keys but can’t unlock a door?

July 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...