# Error management in elasticsearch output plugin

**URL:** https://discuss.elastic.co/t/error-management-in-elasticsearch-output-plugin/351100
**Category:** Logstash
**Tags:** docker
**Created:** [January 15, 2024, 6:09pm UTC](https://discuss.elastic.co/t/error-management-in-elasticsearch-output-plugin/351100 "2024-01-15T18:09:26Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Cesar\_Garcia1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cesar_garcia1/32/126664_2.png) [@Cesar\_Garcia1](https://discuss.elastic.co/u/Cesar_Garcia1)
#### Post date: [January 15, 2024, 6:09pm UTC](https://discuss.elastic.co/t/error-management-in-elasticsearch-output-plugin/351100/1 "2024-01-15T18:09:26Z")

</div>

Hello everyone  
Hello to all of you  
I have a problem with logstash and elasticsearch  
I have this configuration file for logstash

```auto
input {
	file {
		path => "${FILE_TO_SEND}"
		sincedb_path => "/dev/null"
		mode => read
		exit_after_read => true
		file_completed_action => log
		file_completed_log_path => "/dev/null"
	}
}

filter {
    json {
        source => "message"
		remove_field => ["@version","host","log","event","message"]
	}
}

output {
	elasticsearch {
		user => "${ELASTIC_USER}"
		password => "${ELASTIC_PASS}"
		hosts => "${ELASTIC_HOST}"
		index => "${INDEX}"
		ssl_certificate_verification => false
	}
}

```

But when I send the data to elasticsearch and the connection fails, I get this message in the log file:

```auto
[WARN] 2024-01-15 16:26:25.644 [[main]-pipeline-manager] elasticsearch - Attempted to resurrect connection to dead ES instance, but got an error {:url=>"http://elastic:xxxxxx@host.docker.internal:9201/", :exception=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :message=>"Elasticsearch Unreachable: [http://host.docker.internal:9201/][Manticore::SocketException] Connect to host.docker.internal:9201 [host.docker.internal/192.168.5.2] failed: Connection refused"}
[INFO] 2024-01-15 16:26:25.775 [[main]-pipeline-manager] elasticsearch - Not eligible for data streams because config contains one or more settings that are not compatible with data streams: {"index"=>"testlogs-testlogs-2024.01.15"}

```

And I need it to show as an error not as a warning  
I need Logstash to tell me that there is an error with the elasticsearch connection and terminate the logstash process.

---

<div class="post-metadata">

### Author: ![yago82](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yago82/32/97755_2.png) [@yago82](https://discuss.elastic.co/u/yago82)
#### Post date: [January 16, 2024, 1:34pm UTC](https://discuss.elastic.co/t/error-management-in-elasticsearch-output-plugin/351100/2 "2024-01-16T13:34:17Z")

</div>

> [@Cesar\_Garcia1](#):
>
> And I need it to show as an error not as a warning

Hi,

connection issues are logged as warnings, not errors, because that's how they're classified in the Logstash code.

If you want to treat these warnings as errors, you would need to implement a custom solution.

Regards

---

<div class="post-metadata">

### Author: ![Cesar\_Garcia1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cesar_garcia1/32/126664_2.png) [@Cesar\_Garcia1](https://discuss.elastic.co/u/Cesar_Garcia1)
#### Post date: [January 16, 2024, 1:50pm UTC](https://discuss.elastic.co/t/error-management-in-elasticsearch-output-plugin/351100/3 "2024-01-16T13:50:00Z")

</div>

Hello, thanks for your answer  
Can you help me with that, there are something in the documentation about how to treat the warnings as error in a custom solution?

---

<div class="post-metadata">

### Author: ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)
#### Post date: [January 16, 2024, 2:37pm UTC](https://discuss.elastic.co/t/error-management-in-elasticsearch-output-plugin/351100/4 "2024-01-16T14:37:00Z")

</div>

> [@Cesar\_Garcia1](#):
>
> Can you help me with that, there are something in the documentation about how to treat the warnings as error in a custom solution?

This is unrelated to Logstash, this kind of error is always logged as WARN, if you need to stop Logstash when this happen you need to use a third-party tool or write some script to check the logs and stop the service.

For example, you could have a bash script that checks the log for this error and stop the service.

---

<div class="post-metadata">

### Author: ![Cesar\_Garcia1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cesar_garcia1/32/126664_2.png) [@Cesar\_Garcia1](https://discuss.elastic.co/u/Cesar_Garcia1)
#### Post date: [January 16, 2024, 3:41pm UTC](https://discuss.elastic.co/t/error-management-in-elasticsearch-output-plugin/351100/5 "2024-01-16T15:41:28Z")

</div>

Ok thaks a lot!!  
Regards

---

<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: [February 13, 2024, 3:41pm UTC](https://discuss.elastic.co/t/error-management-in-elasticsearch-output-plugin/351100/6 "2024-02-13T15:41:46Z")

</div>

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