Splunk Search

stats,streamstats command question

nnonm111
Path Finder

I'm going to check the permission and rejection of the scan attack per hour.
At this point, what I wrote...
Which is appropriate, Vlaues or the list?
Also, which one is suitable, stats or stream stats?


index="firewall" (action="allow" OR action="deny" ) AND ( attack="*scan")
| bin _time span=1d
| stats count by _time,src_ip,dest_ip,app
| stats values(dest_ip) AS dest_ip , values(count) AS count by _time,src_ip,app
| table _time, src_ip ,app, dest_ip , count


Labels (1)
Tags (2)
0 Karma
1 Solution

venkatasri
SplunkTrust
SplunkTrust
index="firewall" (action="allow" OR action="deny" ) AND ( attack="*scan")
| bin _time span=1h
| stats count by _time,src_ip,dest_ip,app
| stats values(dest_ip) AS dest_ip , sum(count) AS count by _time,src_ip,app
| table _time, src_ip ,app, dest_ip , count

I have updated SPL, list() is an aggregation function it doesn't care of duplicates and by is clause for grouping.

 

View solution in original post

0 Karma

venkatasri
SplunkTrust
SplunkTrust

@nnonm111  stats should work for your case changed span to 1h. 

index="firewall" (action="allow" OR action="deny" ) AND ( attack="*scan")
| bin _time span=1h
| stats count by _time,src_ip,dest_ip,app
| stats values(dest_ip) AS dest_ip , values(count) AS count by _time,src_ip,app
| table _time, src_ip ,app, dest_ip , count

0 Karma

venkatasri
SplunkTrust
SplunkTrust

instead of values(count) in second stats try sum(count)

0 Karma

nnonm111
Path Finder

thankyou 

I understand the difference between value and list is deduplication, which value will be removed?
Also, if you do list(app) and by app, the values are different.
What's the reason?

0 Karma

venkatasri
SplunkTrust
SplunkTrust
index="firewall" (action="allow" OR action="deny" ) AND ( attack="*scan")
| bin _time span=1h
| stats count by _time,src_ip,dest_ip,app
| stats values(dest_ip) AS dest_ip , sum(count) AS count by _time,src_ip,app
| table _time, src_ip ,app, dest_ip , count

I have updated SPL, list() is an aggregation function it doesn't care of duplicates and by is clause for grouping.

 

0 Karma

nnonm111
Path Finder

index="firewall" (action="allow" OR action="deny" ) AND ( attack="*scan")
| bin _time span=1h
| stats count by _time,src_ip,dest_ip,app
| stats values(dest_ip) AS dest_ip , sum(count) AS count  by _time,src_ip,app
| table _time, src_ip ,app, dest_ip , count



index="firewall" (action="allow" OR action="deny" ) AND ( attack="*scan")
| bin _time span=1h
| stats count by _time,src_ip,dest_ip,app
| stats values(dest_ip) AS dest_ip , sum(count) AS count values(app) AS app by _time,src_ip
| table _time, src_ip ,app, dest_ip , count


What's the difference if the app changes?

0 Karma
Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...