# Error: initialize: name or service not known

**URL:** https://discuss.elastic.co/t/error-initialize-name-or-service-not-known/141357
**Category:** Logstash
**Created:** [July 24, 2018, 10:42am UTC](https://discuss.elastic.co/t/error-initialize-name-or-service-not-known/141357 "2018-07-24T10:42:50Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![prashansa1](https://avatars.discourse-cdn.com/v4/letter/p/a3d4f5/32.png) [@prashansa1](https://discuss.elastic.co/u/prashansa1)
#### Post date: [July 24, 2018, 10:42am UTC](https://discuss.elastic.co/t/error-initialize-name-or-service-not-known/141357/1 "2018-07-24T10:42:51Z")

</div>

I'm trying to execute logstash script from local to connect with external server.

but It is throwing these errors.

ERROR logstash.pipeline - A plugin had an unrecoverable error. Will restart this plugin  
Plugin: \<LogStash::Inputs::Elasticsearch hosts=\>["{external\_logstash\_host}"], index=\>"{index\_name}", type=\>"{index\_data\_type}", query=\>"{\n\t\t"query": {"bool":{"must":[{"match":{"test\_id":"12xxxx"}},\n\t\t{"range":{"test\_tms": {"gte":"2018-07-23T04:00:35.000Z","lte":"2018-07-23T05:00:35.000Z"}}}]\n\t\t\n\t\t\n\t\t}}\n\t\t}", add\_field=\>{"file\_date"=\>""}, user=\>"{user\_name}", password=\>, ssl=\>true, docinfo=\>true, id=\>"{id\_value}", enable\_metric=\>true, codec=\>\<LogStash::Codecs::JSON id=\>"{json\_id}", enable\_metric=\>true, charset=\>"UTF-8"\>, size=\>1000, scroll=\>"1m", docinfo\_target=\>"@metadata", docinfo\_fields=\>["\_index", "\_type", "\_id"]\>

Error: initialize: name or service not known

---

<div class="post-metadata">

### Author: ![guyboertje](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/guyboertje/32/31592_2.png) [@guyboertje](https://discuss.elastic.co/u/guyboertje)
#### Post date: [July 25, 2018, 10:08am UTC](https://discuss.elastic.co/t/error-initialize-name-or-service-not-known/141357/2 "2018-07-25T10:08:38Z")

</div>

I think you are trying to use interpolation.

The syntax is `%{fieldname}`

The elasticsearch output setting hosts does not allow interpolation, some settings do but a lot don't.

---

<div class="post-metadata">

### Author: ![prashansa1](https://avatars.discourse-cdn.com/v4/letter/p/a3d4f5/32.png) [@prashansa1](https://discuss.elastic.co/u/prashansa1)
#### Post date: [July 26, 2018, 9:53am UTC](https://discuss.elastic.co/t/error-initialize-name-or-service-not-known/141357/3 "2018-07-26T09:53:49Z")

</div>

Hi, thanks for valuable feedback It would be really helpful if you could explain in detail.

---

<div class="post-metadata">

### Author: ![prashansa1](https://avatars.discourse-cdn.com/v4/letter/p/a3d4f5/32.png) [@prashansa1](https://discuss.elastic.co/u/prashansa1)
#### Post date: [July 26, 2018, 11:33am UTC](https://discuss.elastic.co/t/error-initialize-name-or-service-not-known/141357/4 "2018-07-26T11:33:56Z")

</div>

Hi @guyboertje Now i'm getting this error , please can you explain

06:08:05.941 [[main]\<elasticsearch] ERROR logstash.pipeline - A plugin had an unrecoverable error. Will restart this plugin.  
Plugin: \<LogStash::Inputs::Elasticsearch hosts=\>["{logstash\_host}"], index=\>"test\_index\*", type=\>"test\_type", query=\>"{"query": {"bool":{"must":[{"match":{"test\_id":"12\*\*\*\*\*\*"}},{"range":{"test\_tms": {"gte":"2018-07-26T05:07:20.000Z","lte":"2018-07-26T06:07:20.000Z"}}}]}}}", add\_field=\>{"file\_date"=\>""}, user=\>"username", password=\>, ssl=\>true, docinfo=\>true, id=\>"123456", enable\_metric=\>true, codec=\>\<LogStash::Codecs::JSON id=\>"234569", enable\_metric=\>true, charset=\>"UTF-8"\>, size=\>1000, scroll=\>"1m", docinfo\_target=\>"@metadata", docinfo\_fields=\>["\_index", "\_type", "\_id"]\>  
Error: 400 "Bad Request"

---

<div class="post-metadata">

### Author: ![guyboertje](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/guyboertje/32/31592_2.png) [@guyboertje](https://discuss.elastic.co/u/guyboertje)
#### Post date: [July 30, 2018, 10:26pm UTC](https://discuss.elastic.co/t/error-initialize-name-or-service-not-known/141357/5 "2018-07-30T22:26:05Z")

</div>

> LogStash::Inputs::Elasticsearch hosts=\>["{logstash\_host}"], index=\>"test\_index\*"...

I think the value inside the `hosts` array is not a valid host name.

Do you have a DNS entry for '{logstash\_host}'?

Do you have a `etc/hosts` entry for '{logstash\_host}'?

Use the IP or host name of the machine that Elasticsearch is running on.

---

<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 27, 2018, 10:26pm UTC](https://discuss.elastic.co/t/error-initialize-name-or-service-not-known/141357/6 "2018-08-27T22:26:05Z")

</div>

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