jertel / elastalert2

ElastAlert 2 is a continuation of the original yelp/elastalert project. Pull requests are appreciated!
https://elastalert2.readthedocs.org
Apache License 2.0
859 stars 277 forks source link

Connection issue of elastalert2 with elasticsearch #1353

Closed Nabeel-Akhtar-Qbatch closed 6 months ago

Nabeel-Akhtar-Qbatch commented 6 months ago

I am trying to connect elastalert2 with elasticsearch but unable to make connection

below is my docker-compose file

version: '3.6' services: Elasticsearch: image: elasticsearch:7.17.0 container_name: elasticsearch restart: always volumes:

volumes: elastic_data: {}

networks: elk

######################## Below is my config.yaml

This is the folder that contains the rule yaml files

rules_folder: /opt/elastalert/rules

run_every: minutes: 5

buffer_time: minutes: 15

Connect with TLS to Elasticsearch

use_ssl: False

Verify TLS certificates

verify_certs: False es_host: Elasticsearch es_port: 9200 es_username: elastic es_password: *** writeback_index: elastalert_status

alert_time_limit: days: 2

################################################## I am unable to make connection of elastalert2 with elasticsearch.

Getting below error in elastalert2 logs NING:elasticsearch:GET http://Elasticsearch:9200/ [status:N/A request:0.021s] Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/urllib3/connection.py", line 174, in _new_conn conn = connection.create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/urllib3/util/connection.py", line 95, in create_connection raise err File "/usr/local/lib/python3.12/site-packages/urllib3/util/connection.py", line 85, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused

elasticsearch.exceptions.ConnectionError: ConnectionError(HTTPConnectionPool(host='elasticsearch', port=9200): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fd8567d1f70>: Failed to establish a new connection: [Errno 111] Connection refused'))) caused by: ConnectionError(HTTPConnectionPool(host='elasticsearch', port=9200): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fd8567d1f70>: Failed to establish a new connection: [Errno 111] Connection refused')))