# Aggregation doesn't work

**URL:** <https://discuss.elastic.co/t/aggregation-doesnt-work/106438>\
**Category:** Logstash\
**Created:** [November 5, 2017, 5:26pm UTC](https://discuss.elastic.co/t/aggregation-doesnt-work/106438 "2017-11-05T17:26:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lkofman](https://avatars.discourse-cdn.com/v4/letter/l/b9e5f3/32.png) [@lkofman](https://discuss.elastic.co/u/lkofman)\
**Post date:** [November 5, 2017, 5:26pm UTC](https://discuss.elastic.co/t/aggregation-doesnt-work/106438/1 "2017-11-05T17:26:21Z")

</div>

I try aggregate data by componentname a-and number how many times it appear in log  
input {  
beats{  
type =\> beats  
port =\> 5044  
}  
}  
filter{  
if [type] == "beats" {  
grok {  
break\_on\_match =\> true  
keep\_empty\_captures =\> false  
match =\> {  
message =\> [  
"%{NUMBER:threadid};%{TIMESTAMP\_ISO8601:eventutctime};%{DATA:username};%{JAVACLASS:apiname};%{WORD:apireturnstatus};%{WORD:componentname};%{BASE10NUM:customisation-level};%{BASE10NUM:cputimeinmillisec};%{WORD:runmode};%{WORD:errorcodeiffailure}",  
"%{NUMBER:threadid};%{TIMESTAMP\_ISO8601:eventutctime};%{DATA:username};%{JAVACLASS:apiname};%{WORD:apireturnstatus};%{WORD:componentname};%{BASE10NUM:customisation-level};%{BASE10NUM:cputimeinmillisec};%{WORD:runmode};(%{GREEDYDATA:errorcodeiffailure})\s\*%{GREEDYDATA:error\_description}"  
]  
}  
patterns\_dir =\> "C:\DoLense\Patterns\patterns"  
}

```
            aggregate {
            task_id => "%{username}_%{threadid}"
            code => "map['componentname']||=0 ; map['componentname']+= 1; "
             push_map_as_event_on_timeout => true
            timeout_task_id_field => "componentname" 
            timeout =>300 #5 minutes
            timeout_tags => ['_aggregatetimeout']
            timeout_code => "event.set('componentname', event.get('componentname') > 1)"
            }
                            
            date {
                   match => ["eventutctime" , "yyyy-MM-dd HH:mm:ss.SSS"]
            }
            
      }

```

}  
output {  
elasticsearch {  
hosts=\>"localhost:9200"  
index =\> "logstash%{+[YYYY.MM.dd.HH.mm](http://YYYY.MM.dd.HH.mm)}%{type}-%{task\_id}"  
}  
stdout {codec=\> rubydebug }  
}

at index I receive raw data and instead task\_id -I get "task\_id" as text not converted  
logstash2017.09.11.00.44beats-%{task\_id}

---

<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:** [December 3, 2017, 5:26pm UTC](https://discuss.elastic.co/t/aggregation-doesnt-work/106438/2 "2017-12-03T17:26:26Z")

</div>

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