Dashboards & Visualizations

TimerangePicker to calculate the start date

linu1988
Champion

Hello Everyone,
i have implemented a case where the events of a log are calculated per day basis. But when i choose the Timerange picker its showing the values according to the events for the last N amount of period unless its custom time.

e.g. Last 24 hours will choose events which are from today 10 AM to yesterdays 10 AM. But the problem is the events for yesterday before 10 AM are neglected in the Per day calculation.

Any insight by which i can make it happen to start any dates at 00:00 AM?

earliest_time = 22/6/13 00:00 AM

Thanks

0 Karma

joebensimo
Path Finder

Add earliest and latest conditions with @d (on day boundaries) to your query.

For example:

For all events yesterday: earliest=-1d@d latest=-0d@d

For all events so far today: earliest=-0d@d latest=now

Be aware that days start and end based on the timezone set for the user performing the query. You can change this in each users' settings if needed.

joebensimo
Path Finder

You can also explicitly tell it to snap to periods other than a day. Eg, -1month@month will snap to the start of the previous month.

You can also use the built-in default datetime fields (eg, date_month) to group stats by time periods. (See http://docs.splunk.com/Documentation/Splunk/5.0.3/Knowledge/UseDefaultFields .)

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Long time ranges such as month to date, previous month, year to date, etc. already snap to the beginning of a day.

0 Karma

linu1988
Champion

It may work for today, yesterday but how do i make a trend chart for a month? I will always need the floor value of the date to my earliest parameter. Let me know if any new idea hits. I need to dig deep.

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

You can define your own time ranges if the pre-defined ones do not suit your cases. For example, you could swap "Last 24 hours" (-24h@h to now) with "Today + Yesterday" (-24h@d to now).

0 Karma

linu1988
Champion

Thanks for the reply, but i can't make the values hard coded as the values will change according to the value changed by the TimeRangePicker module

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...