# Wrap logstash information into another object

**URL:** <https://discuss.elastic.co/t/wrap-logstash-information-into-another-object/161749>\
**Category:** Logstash\
**Created:** [December 20, 2018, 7:22pm UTC](https://discuss.elastic.co/t/wrap-logstash-information-into-another-object/161749 "2018-12-20T19:22:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luksi1](https://avatars.discourse-cdn.com/v4/letter/l/e68b1a/32.png) [@luksi1](https://discuss.elastic.co/u/luksi1)\
**Post date:** [December 20, 2018, 7:22pm UTC](https://discuss.elastic.co/t/wrap-logstash-information-into-another-object/161749/1 "2018-12-20T19:22:44Z")

</div>

We're performing Elasticsearch updates with scripts and upserts and we want to wrap everything in the Logstash filter into another object.

Take for instance:

```
grok {
  patterns_dir => "/etc/logstash/grok_patterns"
  break_on_match => false
  match => {
    "message" => [
      "^Foo=%{NWGREEDYDATA:Foo}"
}

```

We would like to be able to grab this entire message + filebeat data and put this into an object. This object then would be sent to Elasticsearch like this:

```
{
  "events": {
    "Foo": "bar"
    "beats": {
      "host": "foo.domain.com"
      ......
    }
  }

```

How would we go about this?

---

<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:** [January 17, 2019, 7:22pm UTC](https://discuss.elastic.co/t/wrap-logstash-information-into-another-object/161749/2 "2019-01-17T19:22:46Z")

</div>

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