# Pass Metadata Field via HTTP Plugin

**URL:** <https://discuss.elastic.co/t/pass-metadata-field-via-http-plugin/181957>\
**Category:** Logstash\
**Created:** [May 21, 2019, 9:09am UTC](https://discuss.elastic.co/t/pass-metadata-field-via-http-plugin/181957 "2019-05-21T09:09:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![salkonuhannovic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/salkonuhannovic/32/47330_2.png) [@salkonuhannovic](https://discuss.elastic.co/u/salkonuhannovic)\
**Post date:** [May 21, 2019, 9:09am UTC](https://discuss.elastic.co/t/pass-metadata-field-via-http-plugin/181957/1 "2019-05-21T09:09:36Z")

</div>

Hi,

I want to ingest data to logstash with following command:  
curl -XPUT '[mylogstashurl.com](http://mylogstashurl.com)' -d 'hello'

I get this data into logstash but unfortunjately the @metadata field is always empty.  
Is there any header i need to pass so I can override the metadata field?

Thanks &BR,  
Salko

---

<div class="post-metadata">

**Author:** ![BennyInc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bennyinc/32/21751_2.png) [@BennyInc](https://discuss.elastic.co/u/BennyInc)\
**Post date:** [May 21, 2019, 9:37am UTC](https://discuss.elastic.co/t/pass-metadata-field-via-http-plugin/181957/2 "2019-05-21T09:37:40Z")

</div>

The @metadata is usually not output - but e.g. for the stdout/rubydebug output you can enable it: [https://www.elastic.co/guide/en/logstash/7.1/event-dependent-configuration.html#metadata](https://www.elastic.co/guide/en/logstash/7.1/event-dependent-configuration.html#metadata)

---

<div class="post-metadata">

**Author:** ![salkonuhannovic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/salkonuhannovic/32/47330_2.png) [@salkonuhannovic](https://discuss.elastic.co/u/salkonuhannovic)\
**Post date:** [May 21, 2019, 10:05am UTC](https://discuss.elastic.co/t/pass-metadata-field-via-http-plugin/181957/3 "2019-05-21T10:05:25Z")

</div>

Thank you for the information. But I am struggeling with a other problem.

This is my Pipeline:

input {  
beats {  
port =\> 5044  
}  
http {  
port =\> 8080  
}  
}  
output {  
elasticsearch {  
hosts =\> ["{ELASTICSEARCH\_HOST}:{ELASTICSEARCH\_PORT}"]  
manage\_template =\> false  
index =\> "%{[@metadata]}-%{+YYYY.MM.dd}"  
document\_type =\> "%{[@metadata][type]}"  
}

}

As you can see I am saving the data to follwing index =\> "%{[@metadata]}-%{+YYYY.MM.dd}". Meaning with this command curl -XPUT '[mylogstashurl.com](http://mylogstashurl.com/)' -d 'hello', the Index where the data gets written to is always is something like this [{}-2019.05.21].

When data is send to logstash via Beats it works totally fine with the index name.

---

<div class="post-metadata">

**Author:** ![BennyInc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bennyinc/32/21751_2.png) [@BennyInc](https://discuss.elastic.co/u/BennyInc)\
**Post date:** [May 21, 2019, 10:48am UTC](https://discuss.elastic.co/t/pass-metadata-field-via-http-plugin/181957/4 "2019-05-21T10:48:45Z")

</div>

If you're in a testing stage still, try adding a stdout output like this:

```auto
 stdout { codec => rubydebug { metadata => true } }

```

This should output the document to stdout, and you'll see what's contained in the @metadata fields. Most likely, your @metadata doesn't get populated the way you expect it to, when using the http input - resulting in an unexpected elasticsearch index name.

---

<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:** [June 18, 2019, 10:48am UTC](https://discuss.elastic.co/t/pass-metadata-field-via-http-plugin/181957/5 "2019-06-18T10:48:47Z")

</div>

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