# How to set HTTP filter body to whole event

**URL:** https://discuss.elastic.co/t/how-to-set-http-filter-body-to-whole-event/243041
**Category:** Logstash
**Created:** [July 29, 2020, 11:29am UTC](https://discuss.elastic.co/t/how-to-set-http-filter-body-to-whole-event/243041 "2020-07-29T11:29:00Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![bradley.king](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bradley.king/32/64314_2.png) [@bradley.king](https://discuss.elastic.co/u/bradley.king)
#### Post date: [July 29, 2020, 11:29am UTC](https://discuss.elastic.co/t/how-to-set-http-filter-body-to-whole-event/243041/1 "2020-07-29T11:29:00Z")

</div>

Hi guys, just a quick question. I can't seem to find the answer on the docs 😕

How do I reference the whole event in logstash?

I want to use the HTTP filter to send the whole event to one of our APIs for some quick analysis.

I have tried the below:

```auto
        http {
                id => "test-http-01"
                url => "URL"
                verb => "POST"
                connect_timeout => 15
                body => "%{[]}"
                headers => { "Accept" => "application/json" "Content" => "application/json"}
                target_body => "[test]"
                target_headers => "[@metadata][test_response_headers]"
        }

```

In other HTTP filters, I reference specific fields like `[server][name]` for example, but how to I get everything? `[]`?

Thanks in advanced!

---

<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: [July 29, 2020, 5:18pm UTC](https://discuss.elastic.co/t/how-to-set-http-filter-body-to-whole-event/243041/2 "2020-07-29T17:18:50Z")

</div>

I have not tested it, but you could try something like

```
ruby { code => 'event.set("[@metadata][body]", event.to_hash)' }

```

then use

```
body => "%{[@metadata][body]}"

```

You might also want to set the body\_format option.

---

<div class="post-metadata">

### Author: ![bradley.king](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bradley.king/32/64314_2.png) [@bradley.king](https://discuss.elastic.co/u/bradley.king)
#### Post date: [July 29, 2020, 9:16pm UTC](https://discuss.elastic.co/t/how-to-set-http-filter-body-to-whole-event/243041/3 "2020-07-29T21:16:07Z")

</div>

That worked great! 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: [August 26, 2020, 9:16pm UTC](https://discuss.elastic.co/t/how-to-set-http-filter-body-to-whole-event/243041/4 "2020-08-26T21:16:08Z")

</div>

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