Splunk Search

count number of grouped events

sarit_s
Communicator

hello
i have this query :

index="prod" eventtype="csm-messages-dhcpd-lpf-eth0-sending" OR eventtype="csm-messages-dhcpd-lpf-eth0-listening" OR eventtype="csm-messages-dhcpd-send-socket-fallback-net" OR eventtype="csm-messages-dhcpd-write-zero-leases" OR eventtype="csm-messages-dhcpd-eth1-nosubnet-declared" 
| stats count list(eventtype) by _time

the result im getting is :

_time count list(eventtype) 2019-08-05
10:24:23 5

csm-messages-dhcpd-send-socket-fallback-net
csm-messages-dhcpd-lpf-eth0-sending
csm-messages-dhcpd-lpf-eth0-listening
csm-messages-dhcpd-eth1-nosubnet-declared
csm-messages-dhcpd-write-zero-leases

what should i change in my query so i will see the count for each raw ?

thanks

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @sarit_s,
try something like this.

index="prod" eventtype="csm-messages-dhcpd-lpf-eth0-sending" OR eventtype="csm-messages-dhcpd-lpf-eth0-listening" OR eventtype="csm-messages-dhcpd-send-socket-fallback-net" OR eventtype="csm-messages-dhcpd-write-zero-leases" OR eventtype="csm-messages-dhcpd-eth1-nosubnet-declared"
| timechart count BY eventtype

Choose the span you like.

Ciao.
Giuseppe

0 Karma

sarit_s
Communicator

looks better but in the _time column it is showing only year and month, how can i show the all timestamp ?
also, i need to collect the events for each timestamp

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...