Xpack and Logstas: Elasticsearch Unreachable: [http://localhost:9200/]

Hi

I installed x-pack on logstash. logstash was running successfully before x-pack. After installation of x-pack, I disable seucirty in elasticseach and logstash by using below command in .yml file
xpack.security.enabled: false

I directed logstash as below
xpack.monitoring.elasticsearch.url: ["http://x.x.x.x:9200"]

x.x.x.x is the elasticsearch server

Logstash is not running and when I run the below command for test

bin/logstash -f /etc/logstash/conf.d/sample.conf

The result is as below
WARNING: Could not find logstash.yml which is typically located in $LS_HOME/config or /etc/logstash. You can specify the path using --path.settings. Continuing using the defaults
Could not find log4j2 configuration at path /usr/share/logstash/config/log4j2.properties. Using default config which logs errors to the console
Elasticsearch Unreachable: [http://localhost:9200/][Manticore::SocketException] Connection refused
[ERROR] 2017-11-24 09:17:41.606 [[.monitoring-logstash]-pipeline-manager] licensemanager - Unable to retrieve license information from license server {:message=>"Elasticsearch Unreachable: [http://localhost:9200/][Manticore::SocketException] Connection refused", :class=>"LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError"}
The stdin plugin is now waiting for input:
[ERROR] 2017-11-24 09:17:43.431 [Ruby-0-Thread-1: /usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/stud-0.0.23/lib/stud/task.rb:22] metrics - Monitoring is not available: License information is currently unavailable. Please make sure you have added your production elasticsearch connection info in the xpack.monitoring.elasticsearch settings.
No Available connections
[ERROR] 2017-11-24 09:18:11.634 [monitoring-license-manager] licensemanager - Unable to retrieve license information from license server {:message=>"No Available connections", :class=>"LogStash::Outputs::ElasticSearch::HttpClient::Pool::NoConnectionAvailableError"}
No Available connections

Hi @saad ,

As pointed out in the logs

WARNING: Could not find logstash.yml which is typically located in $LS_HOME/config or /etc/logstash. You can specify the path using --path.settings. Continuing using the defaults

So logstash can't find the logstash.yml where you set the xpack.monitoring.elasticsearch.url and it attempts to use default value for the elasticsearch url, which is http://localhost:9200 . No, nothing is listening on 9200 on your machine, hence you get a

Elasticsearch Unreachable: [http://localhost:9200/][Manticore::SocketException] Connection refused

  • Where is your logstash.yml located ?
  • Are your $LS_HOME or $LS_SETTINGS_DIR environment variable set ? You can check with echo $LS_HOME or echo $LS_SETTINGS_DIR.

Alternatively you can try and pass the configuration dir path with
--path.settings=/path/to/your/logstash/config/dir/ , such as

bin/logstash -f /etc/logstash/conf.d/sample.conf --path.settings=/path/to/your/logstash/config/dir/

Thank you,

I am using the default directory /etc/logstash and the file is logstash.yml

I run bin/logstash -f /etc/logstash/conf.d/sample.conf --path.settings=/etc/logstash
and was successful

Now, how can I run logstash from systemctl and let it go to that /etc/logstash to read the yml file?

$LS_HOME and $LS_SETTINGS_DIR are empty with no values

by running echo $LS_HOME

Assuming your OS is supported, is it an option for you to install logstash using one of the available packages for your distribution ? That way you can take advantage of the service conf files and run it as a service using Systemd

i installed logstash by using rpm way. the OS i am using is Centos 7

Great, then as stated in the documentation, start logstash with

sudo systemctl start logstash.service

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