# Aggregate filter does not create a value in the output

**URL:** <https://discuss.elastic.co/t/aggregate-filter-does-not-create-a-value-in-the-output/169568>\
**Category:** Logstash\
**Created:** [February 22, 2019, 11:35am UTC](https://discuss.elastic.co/t/aggregate-filter-does-not-create-a-value-in-the-output/169568 "2019-02-22T11:35:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ozmhsh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ozmhsh/32/49129_2.png) [@ozmhsh](https://discuss.elastic.co/u/ozmhsh)\
**Post date:** [February 22, 2019, 11:35am UTC](https://discuss.elastic.co/t/aggregate-filter-does-not-create-a-value-in-the-output/169568/1 "2019-02-22T11:35:54Z")

</div>

In my aggregate filter, I would expect to create new output values 'StartTime' and 'EndTime', by using the timestamp 'tmstp' value of the Start Event and End Event. As following:

```
   if [Status] == "Start" {
   
      aggregate {
       task_id => "%{ThreadName}"
       code => "map['StartTime'] ||= event.get('tmstp')"
       map_action => "create"
	    add_tag => ["grokked", "Drop"]
     }
                     
   }

 
	
    if [Status] == "End" {
	
	 aggregate {
       task_id => "%{ThreadName}"
       code => "event.set('EndTime', event.get('tmstp'))" **-------> This line is not working as expected. In the output event, I can see the value for 'tmstp' but there is no output entry for 'EndTime'.**
	   map_action => "update"
       end_of_task => true
       timeout => 120
			}	
    }

```

Any idea?

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [February 22, 2019, 1:52pm UTC](https://discuss.elastic.co/t/aggregate-filter-does-not-create-a-value-in-the-output/169568/2 "2019-02-22T13:52:53Z")

</div>

What does the data look like? Does the "End" line contain ThreadName? If not, the aggregate will do nothing.

---

<div class="post-metadata">

**Author:** ![ozmhsh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ozmhsh/32/49129_2.png) [@ozmhsh](https://discuss.elastic.co/u/ozmhsh)\
**Post date:** [February 22, 2019, 8:22pm UTC](https://discuss.elastic.co/t/aggregate-filter-does-not-create-a-value-in-the-output/169568/3 "2019-02-22T20:22:44Z")

</div>

I can see the output generated by the End event, just that EndTime attribute is not shown.

---

<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:** [March 22, 2019, 8:35pm UTC](https://discuss.elastic.co/t/aggregate-filter-does-not-create-a-value-in-the-output/169568/4 "2019-03-22T20:35:15Z")

</div>

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