Custom Date range selectors

Hi community,
Had Data Analyst training this week and I asked if there were options to add the following to date picker section:-

  • Yesterday
  • Last Week
  • Last Month
  • This Week
  • This Month

I was advised that this could not be done. However, I found these previous posts
How to create a custom time range for Last Month in kibana &
Time Filter for the current month

As a newby to Kibana and coding in general would I just replace the M with D for Day and W for Week to create what I require. Example for yesterday below?

   "from": "now/D-1D",
   "to": "now-1D/D",
   "display": "Yesterday (Custom)",
   "section": 1

You can use the following for last week / last month:

    "from": "now-1w", #replace with -1m for month
    "to": "now",
    "display": "Last 1 week"

Instead for this week and this month you do something like this:

    "from": "now/w", #replace with M for month
    "to": "now/w", # replace with M for month
    "display": "This week"

Note that This week is a default kibana quick range.

So yesterday is:

   "from": "now/d-1d",
   "to": "now/d-1d",
   "display": "Yesterday (Custom)",
   "section": 1

By the way I found not easy to learn and understand quick ranges from the documentation (I'm the author of one of the othere post you mentioned) so I hope that the documentation will be improved.
This filters are very, very important for anyone who works with data (and not just for logging).

1 Like

Thank you @mattiacareddu. Totally agree - they are important and I'm a little surprised they are not available as standard. I will pass these on so they can be created in our environments.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.