Splunk Search

Filtering based on quantity of list() results

Sam2
Explorer

Hello all,

I have this search:

...| streamstats window=1 global=false current=f last(_time) as next_time by cs_host,username| eval gap = next_time - _time |search gap>350| stats list(gap) by cs_host,username

which draws a nice table, grouped by list(gap). However, I'd like to remove any rows in the table that only have one results of list(gap), but am struggling with the syntax. Can anyone help please?

Tags (1)
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

How about this:

... | streamstats window=1 global=false current=f last(_time) as next_time by cs_host,username| eval gap = next_time - _time | search gap>350 | stats count list(gap) by cs_host username | where count > 1

View solution in original post

martin_mueller
SplunkTrust
SplunkTrust

How about this:

... | streamstats window=1 global=false current=f last(_time) as next_time by cs_host,username| eval gap = next_time - _time | search gap>350 | stats count list(gap) by cs_host username | where count > 1

Sam2
Explorer

Yes, that works! I think I was trying to over complicate it!

0 Karma
Get Updates on the Splunk Community!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...