Hello everyone
Hello to all of you
I have a problem with logstash and elasticsearch
I have this configuration file for logstash
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:
[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.