# Help creating 'Time since last logged-in' chart

**URL:** <https://discuss.elastic.co/t/help-creating-time-since-last-logged-in-chart/133809>\
**Category:** Kibana\
**Created:** [May 30, 2018, 7:38am UTC](https://discuss.elastic.co/t/help-creating-time-since-last-logged-in-chart/133809 "2018-05-30T07:38:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ben\_at\_Transpire](https://avatars.discourse-cdn.com/v4/letter/b/ecccb3/32.png) [@Ben\_at\_Transpire](https://discuss.elastic.co/u/Ben_at_Transpire)\
**Post date:** [May 30, 2018, 7:38am UTC](https://discuss.elastic.co/t/help-creating-time-since-last-logged-in-chart/133809/1 "2018-05-30T07:38:53Z")

</div>

Hi Elasticsearch community,

I've got a requirement to display a time since last logged-in chart where the output is to be:  
Y axis: count of user\_id's having logged in between a specific time group  
X axis: specific date group differences such as 3 days, 10 days, 15 days, 30 days, 3 months, 3+ months.

Every time a user is logged in, we have a row stored with the additional fields { "user\_id" : user\_id, "sign\_in\_status" : "success" }. There is a timestamp for each row created.

In terms of the date differences groupings: I've tried using a date-range @timestamp with now-3d, now-10d, now-15d, now-1m, now-3m which is the closest I feel I've been.  
My Y-axis is doing a count  
My X-axis is aggregating @fields.data.user\_id.keyword with a Metric:Count

Any help would be greatly appreciated,  
Thank you

---

<div class="post-metadata">

**Author:** ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)\
**Post date:** [May 30, 2018, 5:19pm UTC](https://discuss.elastic.co/t/help-creating-time-since-last-logged-in-chart/133809/2 "2018-05-30T17:19:13Z")

</div>

Sounds like what you've got is exactly what you need... The only thing that seems missing is a filter, which you can add in "add a filter", then select "sign\_in\_status", then "is", then "success".

---

<div class="post-metadata">

**Author:** ![Ben\_at\_Transpire](https://avatars.discourse-cdn.com/v4/letter/b/ecccb3/32.png) [@Ben\_at\_Transpire](https://discuss.elastic.co/u/Ben_at_Transpire)\
**Post date:** [June 1, 2018, 4:09am UTC](https://discuss.elastic.co/t/help-creating-time-since-last-logged-in-chart/133809/3 "2018-06-01T04:09:59Z")

</div>

Thank you Lukas, this helped a lot.

I ended up having to change the y-axis to a unique count of user\_id's and a date range on the @timestamp field for the x-axis and divided the timestamps into 6 date range groups.

Cheers,

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 29, 2018, 4:10am UTC](https://discuss.elastic.co/t/help-creating-time-since-last-logged-in-chart/133809/4 "2018-06-29T04:10:03Z")

</div>

Closed on June 29, 2018, 4:10am UTC

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