Splunk Search

stats count issue, mismatch with search query results

delalegro
Engager

Hello,

i'm using a query to find all traffic hitting a singe firewall rule.
it's something like this: host=fw_host_name rule_uid={uid} action=accept

i wanted to create a list of all sources, destinations and services(ports) with a count so i added | stats count by src dst service
The output i get is perfect for example the following row src:192.168.1.1 dst:8.8.8.8 service:22 count:71

but if i do the following search query over the same time: host=fw_host_name rule_uid={uid} action=accept src=192.168.1.1 dst=8.8.8.8 service=22 splunk returns 85 events.

so whats wrong with the stats count that it's not returning all events?

Thanks in advance for your help!

0 Karma

somesoni2
Revered Legend

How many events you get, for same time range, for this query

host=fw_host_name rule_uid={uid} action=accept src=192.168.1.1 dst=8.8.8.8 service=22  | stats count by src dst service

AND

 host=fw_host_name rule_uid={uid} action=accept src=* dst=* service=* | stats count by src dst service
0 Karma

renjith_nair
Legend

Its possible that you are getting live data and by the time you execute the second search , you have more events indexed.

Try your searches for a specific time period. for eg: datetime range

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma

delalegro
Engager

Thanks for your answer, sorry for being not clear. I used the same date time range for both queries.

0 Karma
Get Updates on the Splunk Community!

Observability Unlocked: Kubernetes & Cloud Monitoring with Splunk IM

Ready to master Kubernetes and cloud monitoring like the pros? Join Splunk’s Growth Engineering team on ...

Index This | What did the zero say to the eight?

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

Splunk Observability Cloud's AI Assistant in Action Series: Onboarding New Hires & ...

This is the fifth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...