# Combine request and response based on field in log - ELK

**URL:** <https://discuss.elastic.co/t/combine-request-and-response-based-on-field-in-log-elk/207073>\
**Category:** Logstash\
**Created:** [November 8, 2019, 8:42am UTC](https://discuss.elastic.co/t/combine-request-and-response-based-on-field-in-log-elk/207073 "2019-11-08T08:42:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pdkgamage](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pdkgamage/32/56591_2.png) [@pdkgamage](https://discuss.elastic.co/u/pdkgamage)\
**Post date:** [November 8, 2019, 8:42am UTC](https://discuss.elastic.co/t/combine-request-and-response-based-on-field-in-log-elk/207073/1 "2019-11-08T08:42:10Z")

</div>

We have ELK setup with filebeat, logstash and elasticsearch and kibana. I need aggregate request and response at the logstash.

I have configured pipeline configuration as below. now log aggregation working without any issue if i use single worker for pipeline. if i use multiple workers aggregation is not happening. any solution to use multiple workers and log aggregation?

```auto
 if [transaction] == "request" { 

       aggregate {
                        task_id => "%{id}"
                        code => "
                        map['method'] = event.get('method')
                        map['request'] = event.get('request')
                        map['user'] = event.get('user')
                        map['application'] = event.get('application')"
                        map_action => "create"
         }
                    drop {}#drop the request before persisting, to save indexing space in elasticsearch server
  }
  if [message] =~ "TRANSACTION:response" {

         aggregate {
                    task_id => "%{id}"
                    code => "
                    event.set('method', map['method'])
                    event.set('response', map['response'])
                    event.set('user', map['user'])
                    event.set('application', map['application'])"
                    map_action => "update"

         }
}

```

---

<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:** [November 8, 2019, 3:02pm UTC](https://discuss.elastic.co/t/combine-request-and-response-based-on-field-in-log-elk/207073/2 "2019-11-08T15:02:51Z")

</div>

> [@pdkgamage](#):
>
> any solution to use multiple workers and log aggregation?

No. You can only use one worker with an aggregate filter.

---

<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 6, 2019, 3:02pm UTC](https://discuss.elastic.co/t/combine-request-and-response-based-on-field-in-log-elk/207073/3 "2019-12-06T15:02:57Z")

</div>

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