# Is there a way to add cookie field to logstash http output plugin?‏

**URL:** https://discuss.elastic.co/t/is-there-a-way-to-add-cookie-field-to-logstash-http-output-plugin/49600
**Category:** Logstash
**Created:** [May 10, 2016, 1:00am UTC](https://discuss.elastic.co/t/is-there-a-way-to-add-cookie-field-to-logstash-http-output-plugin/49600 "2016-05-10T01:00:41Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![prince6635](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prince6635/32/9681_2.png) [@prince6635](https://discuss.elastic.co/u/prince6635)
#### Post date: [May 10, 2016, 1:00am UTC](https://discuss.elastic.co/t/is-there-a-way-to-add-cookie-field-to-logstash-http-output-plugin/49600/1 "2016-05-10T01:00:41Z")

</div>

With the following configuration, I just want to forward logs from a file to an http endpoint with cookie being set, but I always got the error "Unknown setting 'cookie' for http {:level=\>:error}", looks like http output plugin doesn't support cookie setting? is there any work around?

```auto
input {
    file {
        path => "/home/ubuntu/test/input.log"
        start_position => "beginning"
    }
}
filter {
}
output {
    http {
            url => "http://test.com/logs"
            http_method => "post"
            mapping => ["Body", "%{message}"]
            cookies => true
            headers => [
                'x-token', '8xxxda92b2xxx5a3f'
            ]
            cookie => [
                'auth-openid', 'xxx6j76xxx9mBvxxxl0yyyqsldfkjOaUhHg'
            ]
            content_type => "application/json"
          }
}

```

Thanks!indent preformatted text by 4 spaces

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [May 10, 2016, 7:25am UTC](https://discuss.elastic.co/t/is-there-a-way-to-add-cookie-field-to-logstash-http-output-plugin/49600/2 "2016-05-10T07:25:01Z")

</div>

Cookies are implemented using HTTP headers so you should be able to use the `headers` option.

---

<div class="post-metadata">

### Author: ![prince6635](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prince6635/32/9681_2.png) [@prince6635](https://discuss.elastic.co/u/prince6635)
#### Post date: [May 10, 2016, 9:54pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-add-cookie-field-to-logstash-http-output-plugin/49600/3 "2016-05-10T21:54:24Z")

</div>

It works, thanks!

---

<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: [July 6, 2017, 4:58am UTC](https://discuss.elastic.co/t/is-there-a-way-to-add-cookie-field-to-logstash-http-output-plugin/49600/4 "2017-07-06T04:58:15Z")

</div>


