# Aggregations in logstash

**URL:** <https://discuss.elastic.co/t/aggregations-in-logstash/28823>\
**Category:** Logstash\
**Created:** [September 8, 2015, 8:55am UTC](https://discuss.elastic.co/t/aggregations-in-logstash/28823 "2015-09-08T08:55:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![deepak13](https://avatars.discourse-cdn.com/v4/letter/d/58956e/32.png) [@deepak13](https://discuss.elastic.co/u/deepak13)\
**Post date:** [September 8, 2015, 8:55am UTC](https://discuss.elastic.co/t/aggregations-in-logstash/28823/1 "2015-09-08T08:55:19Z")

</div>

Hi all,  
How can we use aggregations in logstash .conf file.My input is a csv file from 2 different sources.I need to group by a field and perform aggregations like sum,average,etc.  
1st csv file has fields:  
date,amt,type  
2nd csv file has fields:  
date,count,type  
So I need to get output like:  
date,type,(tot\_amt/tot\_count)

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [September 8, 2015, 8:59am UTC](https://discuss.elastic.co/t/aggregations-in-logstash/28823/2 "2015-09-08T08:59:58Z")

</div>

The only way I can think of would be to index each file separately, then query the data from ES and then reindex it.

There's currently no way to do this in LS I can think of. Someone else might have something though.

---

<div class="post-metadata">

**Author:** ![deepak13](https://avatars.discourse-cdn.com/v4/letter/d/58956e/32.png) [@deepak13](https://discuss.elastic.co/u/deepak13)\
**Post date:** [September 8, 2015, 11:44am UTC](https://discuss.elastic.co/t/aggregations-in-logstash/28823/3 "2015-09-08T11:44:41Z")

</div>

I am new to elasticsearch.Can you expain where to query data in elasticsearch which you mentioned above.

---

<div class="post-metadata">

**Author:** ![fbaligand](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fbaligand/32/5657_2.png) [@fbaligand](https://discuss.elastic.co/u/fbaligand)\
**Post date:** [November 7, 2015, 4:04pm UTC](https://discuss.elastic.co/t/aggregations-in-logstash/28823/4 "2015-11-07T16:04:34Z")

</div>

To compute sum, avg, etc, you could use metrics filter

---

<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:** [July 6, 2017, 5:23am UTC](https://discuss.elastic.co/t/aggregations-in-logstash/28823/5 "2017-07-06T05:23:31Z")

</div>


