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
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!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...