# Search Kibana for Out of Hours Logs

**URL:** <https://discuss.elastic.co/t/search-kibana-for-out-of-hours-logs/112645>\
**Category:** Kibana\
**Created:** [December 20, 2017, 1:58pm UTC](https://discuss.elastic.co/t/search-kibana-for-out-of-hours-logs/112645 "2017-12-20T13:58:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MultiplierMultiplier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/multipliermultiplier/32/25063_2.png) [@MultiplierMultiplier](https://discuss.elastic.co/u/MultiplierMultiplier)\
**Post date:** [December 20, 2017, 1:58pm UTC](https://discuss.elastic.co/t/search-kibana-for-out-of-hours-logs/112645/1 "2017-12-20T13:58:29Z")

</div>

Hi All,

I would like to search for logs with the field 'Target'UserName' that are from 19:00:00 until 07:00:00. This would allow me to monitor for out of hours activity for our users. I understand how to find logs with the field 'TargetUserName', I use _exists_:TargetUserName. I just need help with showing on logs with a TimeStamp from 7pm until 7am. I have tried the below Regex:

TimeStamp:/(\d{4}-\d{2}-\d{2}\s(19|20|21|22|23|01|02|03|04|05|06|1|2|3|4|5|6):\d+:\d+)/

When I run that Regex query I see no logs.

EDIT:  
Here is an example of the TimeStamp field so you can see the format:

> Dec 20 14:01:00

Any ideas?

Cheers,

George

---

<div class="post-metadata">

**Author:** ![Nathan\_Reese](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nathan_reese/32/84829_2.png) [@Nathan\_Reese](https://discuss.elastic.co/u/Nathan_Reese)\
**Post date:** [December 20, 2017, 6:53pm UTC](https://discuss.elastic.co/t/search-kibana-for-out-of-hours-logs/112645/2 "2017-12-20T18:53:38Z")

</div>

I would recommend re-indexing your data and adding a new field called `minuteOfDay` that contains the time of day in minutes (a value between 0 and 1440). Then you can simply query for something like `minuteOfDay: [0 TO 420] OR minuteOfDay: [1140 TO 1440]`

---

<div class="post-metadata">

**Author:** ![MultiplierMultiplier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/multipliermultiplier/32/25063_2.png) [@MultiplierMultiplier](https://discuss.elastic.co/u/MultiplierMultiplier)\
**Post date:** [December 20, 2017, 7:22pm UTC](https://discuss.elastic.co/t/search-kibana-for-out-of-hours-logs/112645/3 "2017-12-20T19:22:34Z")

</div>

All of my logs are coming from Graylog, how would I go about parsing a single field into another field?

I would need to parse TimeStamp -\> HourOfDay.

How would I go about doing this?

Cheers

George

---

<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:** [January 17, 2018, 7:22pm UTC](https://discuss.elastic.co/t/search-kibana-for-out-of-hours-logs/112645/4 "2018-01-17T19:22:50Z")

</div>

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