Splunk Search

How to use streamstats to evaluate events from different sourcetypes?

bhavlik
Path Finder

Background:  I'm trying to create a monthly report that tracks how many terminals we Add and how many terminals we Remove at a property.  We have two separate events that track these:  RoomTerminalAdd and RoomTerminalRemove.  

Sometimes we have field reps that need to troubleshoot these terminals and end up with multiples of these events that don't actually indicate a full Add or Remove.  I would like to "pair up" these events and evaluate the time differences based on the property, room number, and terminal address.  If the time difference is below 15 minutes then I want to removed them from the final monthly count.  

Here's a visual to help explain what I'm trying to do:

bhavlik_0-1592261741653.png

After removing these "pairs" that fit the <15 min time difference, I want to then get a total count of each event type separately.   TerminalsAdded=##  TerminalsRemoved=##

I have used the command transaction in the past but won't work here as it removes any events that don't have a pair and I need to keep those for my overall count.  My next option would be streamstats but I don't have any experience with using that command and not sure how to bring in the time difference for evaluating what to keep and what to remove from search.  

Anyone out there have any advice or tips on how to reach my end goal?

0 Karma
Get Updates on the Splunk Community!

See your relevant APM services, dashboards, and alerts in one place with the updated ...

As a Splunk Observability user, you have a lot of data you have to manage, prioritize, and troubleshoot on a ...

Index This | What goes away as soon as you talk about it?

May 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this month’s ...

What's New in Splunk Observability Cloud and Splunk AppDynamics - May 2025

This month, we’re delivering several new innovations in Splunk Observability Cloud and Splunk AppDynamics ...