Splunk Search

Event count from 2 dates

ataunk
Explorer

How do we get event count from 2 dates. Something like this -

              2/11/18            3/11/18           4/11/18

Event1 12 15 10
Event2 50 60 78

index =ind_prod...|eval abctime=strptime(abctime, "%Y-%m-%d") | search abctime>=$t.earliest$ AND abctime=$t.latest$

I tried above query, but it is not working

Tags (3)

woodcock
Esteemed Legend

Assuming that your conversion of abctime is correct (A BIG ASSUMPTION) and your other field is called Event (a guess), try this (you were missing a < for one thing):

index =ind_prod...
| eval abctime=strptime(abctime, "%Y-%m-%d")
| search abctime>=$t.earliest$ AND abctime<=$t.latest$
| bin _time span=1d
| eval _time = strftime(_time, "%m/%d/%Y")
| chart count BY event _time

ataunk
Explorer

I want count for 2 specific date, something like this :
31-Jul 24-Jul
SessionCount 100000 150000
X Count 2000 2200
Y Count 100 200

0 Karma

woodcock
Esteemed Legend

You have said that several times. Show us a few RAW EVENTS, note what fields are where inside of tohse events, and then show us a mockup of the final output that would be generated from JUST those events.

0 Karma

woodcock
Esteemed Legend

If you need 2 specific dates, then just set your Time picker to cover that timespan.

0 Karma

woodcock
Esteemed Legend

You have not shown us what the events look like (where abctime is).

0 Karma

ataunk
Explorer

instead of abctime we can take _time

0 Karma

renjith_nair
Legend

@ataunk ,

index =ind_prod|eval date=strftime(_time,"%Y-%m-%d")|chart count over event_name by date

where event_name is field name of your events

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

ataunk
Explorer

This will give for all the days selected in time range, I want for specific 2 date, something like this

  31-Jul 24-Jul

SessionCount 100000 150000

X Count 2000 2200

Y Count 100 200

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

.conf25 Global Broadcast: Don’t Miss a Moment

Hello Splunkers, .conf25 is only a click away.  Not able to make it to .conf25 in person? No worries, you can ...

Observe and Secure All Apps with Splunk

 Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What's New in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...