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!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...