# Allow logstash-output-http to send binary data

**URL:** https://discuss.elastic.co/t/allow-logstash-output-http-to-send-binary-data/62919
**Category:** Elasticsearch
**Created:** [October 13, 2016, 9:11am UTC](https://discuss.elastic.co/t/allow-logstash-output-http-to-send-binary-data/62919 "2016-10-13T09:11:05Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![marcoh00](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@marcoh00](https://discuss.elastic.co/u/marcoh00)
#### Post date: [October 13, 2016, 9:11am UTC](https://discuss.elastic.co/t/allow-logstash-output-http-to-send-binary-data/62919/1 "2016-10-13T09:11:05Z")

</div>

Hello there,

I'm trying to process binary data through Logstash to upload it to an HTTP endpoint (via PUT). My input data contains some fields I want to index into ElasticSearch and a field containing binary data encoded in base64, togehther with a file name. My goal is to submit the base64 encoded data to ElasticSearch (so the attachment ingest can index metadata/containing text) and to upload a decoded version to a HTTP endpoint, so I can retrieve the whole file later.

What I did now is to write a Logstash plugin which expects three options: Source field, target field and operation (encode/decode). I use it to decode the base64 from the source field to a new field, with a forced "BINARY" encoding.

My plan was to use the output-http plugin to push the files onto a WebDAV share. For this, I have configured it like this:

```
output {
    http {
        url => "http://webdav/%{filename}"
        http_method => "put"
        content_type => "application/octet-stream"
        format => "message"
        message => "%{data_decoded}"
    }
}

```

This works as long as the decoded data is actually plaintext but fails for arbitrary binary data. My temporary solution is to patch the http output to use event.get(@message) instead of event.sprintf and to specify a field instead of a format string in the message parameter.

My question is: Would it be possible to get this upstreamed somehow? I see you can't change message's behavior just like that, but maybe introducing a new format or another message parameter would work out. Alternatively, do you have any other ideas how I could improve the import process?

Thank you very much in advance!

---

<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 5, 2017, 10:12pm UTC](https://discuss.elastic.co/t/allow-logstash-output-http-to-send-binary-data/62919/2 "2017-07-05T22:12:41Z")

</div>


