# fIlter by hour given timestamp

**URL:** <https://discuss.elastic.co/t/filter-by-hour-given-timestamp/96426>\
**Category:** Logstash\
**Created:** [August 9, 2017, 11:11am UTC](https://discuss.elastic.co/t/filter-by-hour-given-timestamp/96426 "2017-08-09T11:11:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tabs11](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@tabs11](https://discuss.elastic.co/u/tabs11)\
**Post date:** [August 9, 2017, 11:11am UTC](https://discuss.elastic.co/t/filter-by-hour-given-timestamp/96426/1 "2017-08-09T11:11:17Z")

</div>

Hi,

I have a huge amount of logs and I want to only parse the data between specific hours. In each log I have a all day information and I want to extract the data in specific hours of the day.

I have a timestamp: "@timestamp" wich can be something like : "2017-08-08T09:01:22.000Z" .

In output I tried to do (just a screen printing):

output {  
if ["@timestamp", ":%{HH}"]\>12 AND ["@timestamp", ":%{HH}"]\<01  
stdout { codec =\> rubydebug }  
}  
}

What is wrong?

Best regards  
Nuno

---

<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:** [September 6, 2017, 11:11am UTC](https://discuss.elastic.co/t/filter-by-hour-given-timestamp/96426/2 "2017-09-06T11:11:30Z")

</div>

Closed on September 6, 2017, 11:11am UTC

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