# Aggregation Based on File Path

**URL:** <https://discuss.elastic.co/t/aggregation-based-on-file-path/250254>\
**Category:** Logstash\
**Created:** [September 28, 2020, 6:35pm UTC](https://discuss.elastic.co/t/aggregation-based-on-file-path/250254 "2020-09-28T18:35:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![NomadicCodeGuy](https://avatars.discourse-cdn.com/v4/letter/n/7cd45c/32.png) [@NomadicCodeGuy](https://discuss.elastic.co/u/NomadicCodeGuy)\
**Post date:** [September 28, 2020, 6:35pm UTC](https://discuss.elastic.co/t/aggregation-based-on-file-path/250254/1 "2020-09-28T18:35:46Z")

</div>

I need to combine "errorInfo" fields of events that share nothing in common except for their file path. The field "log.file.path" exists as a field for my data in kibana but am not sure if a field needs to be explicitly declared in my logstash configuration to use it as a task\_id for aggregations. I would like to do something like this:

```auto
aggregate {
    task_id => "%{log.file.path}" 
    code => "map['combinedInfo' ||= ""; map['combinedInfo'] += event.get('errorInfo')"
    push_map_as_event_on_timeout => true
    timeout_task_id_field => "log.file.path"
    timeout => 300
    timeout_tags => ['_aggregatetimeout']
}

```

But am unsure how to deal with using file path as a task\_id or how to concatenate two string fields in the "code" setting in the aggregate filter plugin. Thanks for your help and guidance.

---

<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:** [September 28, 2020, 8:24pm UTC](https://discuss.elastic.co/t/aggregation-based-on-file-path/250254/2 "2020-09-28T20:24:20Z")

</div>

> [@NomadicCodeGuy](#):
>
> `task_id => "%{log.file.path}"`

That should probably be "%{[log][file][path]}"

---

<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:** [October 26, 2020, 8:24pm UTC](https://discuss.elastic.co/t/aggregation-based-on-file-path/250254/3 "2020-10-26T20:24:38Z")

</div>

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