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.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...