# Logstash Input HTTP Plugin

**URL:** <https://discuss.elastic.co/t/logstash-input-http-plugin/42420>\
**Category:** Logstash\
**Created:** [February 22, 2016, 6:41pm UTC](https://discuss.elastic.co/t/logstash-input-http-plugin/42420 "2016-02-22T18:41:55Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![njbhatt18](https://avatars.discourse-cdn.com/v4/letter/n/cdc98d/32.png) [@njbhatt18](https://discuss.elastic.co/u/njbhatt18)\
**Post date:** [February 22, 2016, 6:41pm UTC](https://discuss.elastic.co/t/logstash-input-http-plugin/42420/1 "2016-02-22T18:41:55Z")

</div>

I am using logstash input plugin and capture all data post on specific port number. I would like to create custom field and during post method I want to capture data on custom field or variable. Can anyone help me for this?

---

<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:** [February 22, 2016, 6:46pm UTC](https://discuss.elastic.co/t/logstash-input-http-plugin/42420/2 "2016-02-22T18:46:50Z")

</div>

Use the [`add_field`](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-http.html#plugins-inputs-http-add_field) option.

```auto
http {
  ...
  add_field => {
    "fieldname" => "fieldvalue"
  }
}

```

---

<div class="post-metadata">

**Author:** ![njbhatt18](https://avatars.discourse-cdn.com/v4/letter/n/cdc98d/32.png) [@njbhatt18](https://discuss.elastic.co/u/njbhatt18)\
**Post date:** [February 22, 2016, 7:08pm UTC](https://discuss.elastic.co/t/logstash-input-http-plugin/42420/3 "2016-02-22T19:08:45Z")

</div>

Yes I did same thing but while posting value from post method I am not  
getting value on logstash server

How I can capture all data pass in HTTP plugin of logstash http

---

<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:** [February 22, 2016, 7:13pm UTC](https://discuss.elastic.co/t/logstash-input-http-plugin/42420/4 "2016-02-22T19:13:37Z")

</div>

Okay, so you want to capture additional data _from the HTTP request_? That wasn't obvious. What data are you missing? Perhaps it would be easier if you gave a complete example if what you're doing, what you get, and what you'd like to get.

---

<div class="post-metadata">

**Author:** ![njbhatt18](https://avatars.discourse-cdn.com/v4/letter/n/cdc98d/32.png) [@njbhatt18](https://discuss.elastic.co/u/njbhatt18)\
**Post date:** [February 23, 2016, 1:59am UTC](https://discuss.elastic.co/t/logstash-input-http-plugin/42420/5 "2016-02-23T01:59:44Z")

</div>

Hi  
I am trying to build logstash as centralize logging and exception management system. I would like to capture application logging and exception via logstash. If any error occur in mobile application or .net application then my developer will post exception / crash report to logstash and logstash will save those data to mongodb.

So in http module I need few extra field like Application Name, Application Type, Authorized Key, Exception, Crash File. But I am not getting proper data in proper field.

input {  
http {  
host =\> "0.0.0.0"  
port =\> 18080  
add\_field =\> ["Authorized\_key", "%{Authorized\_key}"]  
add\_field =\> ["Application\_Name", "%{Application\_Name}"]  
}  
}

output {  
mongodb {  
database =\> "local"  
collection =\> "local"  
uri =\> "mongodb://localhost:27017"  
}  
}

---

<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:** [February 23, 2016, 6:45am UTC](https://discuss.elastic.co/t/logstash-input-http-plugin/42420/6 "2016-02-23T06:45:20Z")

</div>

You have supplied your configuration, which is a good start but I asked for a complete example. What does the posted data look like?

> add\_field =\> ["Authorized\_key", "%{Authorized\_key}"]

What is this supposed to mean? From where would the Authorized\_key value come? The posted data? Perhaps what you're missing is `codec => json` for the input.

---

<div class="post-metadata">

**Author:** ![njbhatt18](https://avatars.discourse-cdn.com/v4/letter/n/cdc98d/32.png) [@njbhatt18](https://discuss.elastic.co/u/njbhatt18)\
**Post date:** [March 10, 2016, 1:55pm UTC](https://discuss.elastic.co/t/logstash-input-http-plugin/42420/7 "2016-03-10T13:55:43Z")

</div>

Hi,

I am sorry for delay. Let me clear what I am trying to build

I am trying to build one common system, where appkey, appname and data are custom fields. If any error occur in any mobile device like android or iphone then my developer will post data to logstash server via post method and pass, appkey, appname and data parameters with real data.

Logstash will get all these data and add into mongodb.

Based on appkey and appname my log analysis team can identify this log is for which application, at what time its occur kind of things.

Same way if any error occur in website then my developer will post all these data to logstash server so we can analyze all those logs.

I hope now my requirement is clear.

---

<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:** [March 10, 2016, 5:57pm UTC](https://discuss.elastic.co/t/logstash-input-http-plugin/42420/8 "2016-03-10T17:57:47Z")

</div>

Okay, good background info but what are the clients posting to Logstash? What does an event look like today?

---

<div class="post-metadata">

**Author:** ![njbhatt18](https://avatars.discourse-cdn.com/v4/letter/n/cdc98d/32.png) [@njbhatt18](https://discuss.elastic.co/u/njbhatt18)\
**Post date:** [March 10, 2016, 6:19pm UTC](https://discuss.elastic.co/t/logstash-input-http-plugin/42420/9 "2016-03-10T18:19:09Z")

</div>

From various sources like mobile devices, webservers, developer machines all will post data to logstash server via http post method. for each http post method, 3 fields are critical (appkey, appname and data). Data variable contains debug error message of app or web. appkey and appname refer to this log entry is for which app or key.

---

<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:** [March 10, 2016, 6:44pm UTC](https://discuss.elastic.co/t/logstash-input-http-plugin/42420/10 "2016-03-10T18:44:39Z")

</div>

Sorry, I give up. I don't know how to express myself in a way so that you give me the information I need to help 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:** [July 6, 2017, 5:07am UTC](https://discuss.elastic.co/t/logstash-input-http-plugin/42420/11 "2017-07-06T05:07:28Z")

</div>


