# Merge JSON events

**URL:** https://discuss.elastic.co/t/merge-json-events/78282
**Category:** Logstash
**Created:** [March 12, 2017, 3:21pm UTC](https://discuss.elastic.co/t/merge-json-events/78282 "2017-03-12T15:21:39Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Dan\_Markhasin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dan_markhasin/32/14187_2.png) [@Dan\_Markhasin](https://discuss.elastic.co/u/Dan_Markhasin)
#### Post date: [March 12, 2017, 3:21pm UTC](https://discuss.elastic.co/t/merge-json-events/78282/1 "2017-03-12T15:21:39Z")

</div>

I'm looking for some way to merge JSON events that have the same ID field.  
For example, given the following incoming events:

{"id":"5f3f1cd7-517d-4d33-b4d5-5a7f6bc7630e", "value1":"somevalue"}  
{"id":"5f3f1cd7-517d-4d33-b4d5-5a7f6bc7630e", "value2":"somevalue"}

I would like to get:

{"id":"5f3f1cd7-517d-4d33-b4d5-5a7f6bc7630e", "value1":"somevalue", "value2":"somevalue"}

I tried using the aggregate filter but it keeps generating empty events. My config is below; am I missing something?

```
aggregate {
    task_id => "%{id}"
    code => ""
    push_map_as_event_on_timeout => true
    timeout_task_id_field => "task_id"
    timeout => 5 # 10 minutes timeout
    timeout_tags => ['_aggregatetimeout']
  }

    if "_aggregatetimeout" not in [tags] {
      drop {}
    }
```

---

<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: [April 9, 2017, 3:21pm UTC](https://discuss.elastic.co/t/merge-json-events/78282/2 "2017-04-09T15:21:41Z")

</div>

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