# Logstash HTTP plugin details

**URL:** https://discuss.elastic.co/t/logstash-http-plugin-details/93439
**Category:** Logstash
**Created:** [July 17, 2017, 5:48pm UTC](https://discuss.elastic.co/t/logstash-http-plugin-details/93439 "2017-07-17T17:48:58Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Bob04](https://avatars.discourse-cdn.com/v4/letter/b/3d9bf3/32.png) [@Bob04](https://discuss.elastic.co/u/Bob04)
#### Post date: [July 17, 2017, 5:48pm UTC](https://discuss.elastic.co/t/logstash-http-plugin-details/93439/1 "2017-07-17T17:48:58Z")

</div>

I have a question about Logstash `http` input plugin:

What is the format of URL for sending POST request to Logstash so Logstash can receive JSON message via `http` plugin?

Is it something like this: `server_name:tcp_port/index` ?

---

<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: [July 18, 2017, 2:12pm UTC](https://discuss.elastic.co/t/logstash-http-plugin-details/93439/2 "2017-07-18T14:12:43Z")

</div>

> Is it something like this: server\_name:tcp\_port/index ?

Yes, and the "index" part in your example can be any string. The plugin will grab all HTTP requests sent to the port.

---

<div class="post-metadata">

### Author: ![Bob04](https://avatars.discourse-cdn.com/v4/letter/b/3d9bf3/32.png) [@Bob04](https://discuss.elastic.co/u/Bob04)
#### Post date: [July 18, 2017, 4:34pm UTC](https://discuss.elastic.co/t/logstash-http-plugin-details/93439/3 "2017-07-18T16:34:54Z")

</div>

@magnusbaeck Thank you.

I am trying to send HTTP request with Java:

```
	HttpClient httpClient = HttpClientBuilder.create().build();
	try {
	    HttpPost request = new HttpPost("http://host_name:31311/test");
	    StringEntity params = new StringEntity("{\"field\":\"value\"}");
	    request.addHeader("content-type", "application/json");
	    request.setEntity(params);
	    HttpResponse response = httpClient.execute(request);
	} catch (Exception ex) {

	}

```

But the data was not sent to Logstash for some reason.

Do you have any ideas what is wrong in this approach?

---

<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: [July 18, 2017, 5:22pm UTC](https://discuss.elastic.co/t/logstash-http-plugin-details/93439/4 "2017-07-18T17:22:48Z")

</div>

So what happens? Does the code raise any exceptions or does the program think things are okay?

Testing and debugging things like this with a tool like curl is recommended.

---

<div class="post-metadata">

### Author: ![Bob04](https://avatars.discourse-cdn.com/v4/letter/b/3d9bf3/32.png) [@Bob04](https://discuss.elastic.co/u/Bob04)
#### Post date: [July 18, 2017, 5:41pm UTC](https://discuss.elastic.co/t/logstash-http-plugin-details/93439/5 "2017-07-18T17:41:38Z")

</div>

Actually, yes. There is the following exception thrown:

```
org.apache.http.conn.HttpHostConnectException: Connect to host_name:31311 [host_name] failed: Connection timed out: connect
	at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:140)

```

I am on Windows, I tried command `open host_name 31311` but I got this:

```
Connecting To host_name...Could not open connection to the host on port 31311: Connect failed

```

This is strange, because I am able to send data via HTTP request from another app from the same machine.

Do you have any thoughts about that?

---

<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: [July 18, 2017, 6:25pm UTC](https://discuss.elastic.co/t/logstash-http-plugin-details/93439/6 "2017-07-18T18:25:34Z")

</div>

Firewall issue maybe, I don't know.

---

<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 15, 2017, 6:25pm UTC](https://discuss.elastic.co/t/logstash-http-plugin-details/93439/7 "2017-08-15T18:25:55Z")

</div>

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