# Logstash - select data by Range

**URL:** <https://discuss.elastic.co/t/logstash-select-data-by-range/103581>\
**Category:** Logstash\
**Created:** [October 11, 2017, 4:49pm UTC](https://discuss.elastic.co/t/logstash-select-data-by-range/103581 "2017-10-11T16:49:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pksingla](https://avatars.discourse-cdn.com/v4/letter/p/c2a13f/32.png) [@pksingla](https://discuss.elastic.co/u/pksingla)\
**Post date:** [October 11, 2017, 4:49pm UTC](https://discuss.elastic.co/t/logstash-select-data-by-range/103581/1 "2017-10-11T16:49:27Z")

</div>

We have following web log transaction data. we need to count number of transactions every 30 second.

input data file:

2017-10-11 10:42:19,server1,load,1  
2017-10-11 10:42:19,server1,load,1  
2017-10-11 10:42:20,server1,load,1  
2017-10-11 10:42:23,server1,load,1  
2017-10-11 10:42:23,server1,load,1  
2017-10-11 10:42:44,server1,load,1  
2017-10-11 10:42:44,server1,load,1  
2017-10-11 10:42:45,server1,load,1  
2017-10-11 10:42:45,server1,load,1  
2017-10-11 10:42:45,server1,load,1  
2017-10-11 10:42:48,server1,load,1  
2017-10-11 10:42:48,server1,load,1  
2017-10-11 10:42:48,server1,load,1  
2017-10-11 10:42:54,server1,load,1  
2017-10-11 10:42:54,server1,load,1  
2017-10-11 10:42:55,server1,load,1  
2017-10-11 10:42:55,server1,load,1  
2017-10-11 10:42:58,server1,load,1  
2017-10-11 10:42:58,server1,load,1  
2017-10-11 11:03:30,server1,load,1  
2017-10-11 11:03:38,server1,load,1  
2017-10-11 11:03:49,server1,load,1  
2017-10-11 11:03:49,server1,load,1  
2017-10-11 11:03:50,server1,load,1  
2017-10-11 11:03:53,server1,load,1  
2017-10-11 11:03:53,server1,load,1  
2017-10-11 11:04:40,server1,load,1

Output expected:

2017-10-11 10:42:30,server1,load,5  
2017-10-11 10:43:00,server1,load,14  
2017-10-11 11:03:30,server1,load,1  
2017-10-11 11:04:00,server1,load,6  
2017-10-11 11:04:30,server1,load,1

Pls provide any inputs on how to achieve this using Logstash script.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [October 12, 2017, 5:22am UTC](https://discuss.elastic.co/t/logstash-select-data-by-range/103581/2 "2017-10-12T05:22:42Z")

</div>

Why do you need to do this in Logstash? If you're using the full Elastic stack this is something you'd typically do in Elasticsearch (and optionally visualizing it in Kibana).

---

<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:** [November 9, 2017, 5:23am UTC](https://discuss.elastic.co/t/logstash-select-data-by-range/103581/3 "2017-11-09T05:23:15Z")

</div>

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