# Push\_map\_as\_event\_on\_timeout with interlaced events

**URL:** <https://discuss.elastic.co/t/push-map-as-event-on-timeout-with-interlaced-events/251017>\
**Category:** Logstash\
**Created:** [October 5, 2020, 3:23pm UTC](https://discuss.elastic.co/t/push-map-as-event-on-timeout-with-interlaced-events/251017 "2020-10-05T15:23:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohsin106](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mohsin106/32/65203_2.png) [@mohsin106](https://discuss.elastic.co/u/mohsin106)\
**Post date:** [October 5, 2020, 3:23pm UTC](https://discuss.elastic.co/t/push-map-as-event-on-timeout-with-interlaced-events/251017/1 "2020-10-05T15:23:50Z")

</div>

Hi,

I have interlaced events that stream in every minute.

For example:

```
event 1:
  task_id: "routerA-site1"
    metric1: val1
    metric2: val2

event 2: 
  task_id:"routerB-site1"
    metric1: val1
    metric2: val2

event3:
  task_id:"routerA-site1"
    metric3: val3
    metric4: val4

```

I want to be able to aggregate event1 and event3 since they both have the same task\_id. I wanted to do something similar to below but it's not producing the output I need. I don't want to map out each individual field and value manually either.

```
aggregate {
            task_id => "%{router}-%{site}"
            timeout_task_id_field => "task_id"
            timeout_timestamp_field => "@timestamp"
            code => "
                event.to_hash.each { |k,v|
                unless map[k]
                    map[k] = v
                end
            }
            "
            #push_previous_map_as_event => true
            push_map_as_event_on_timeout => true
            timeout => 60
        }

```

Thank you.

---

<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 2, 2020, 3:23pm UTC](https://discuss.elastic.co/t/push-map-as-event-on-timeout-with-interlaced-events/251017/2 "2020-11-02T15:23:54Z")

</div>

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