# This is the folder that contains the rule yaml files # This can also be a list of directories # Any .yaml file will be loaded as a rule rules_folder:/opt/elastalert/rules
# How often ElastAlert will query Elasticsearch # The unit can be anything from weeks to seconds run_every: minutes:1
# ElastAlert will buffer results from the most recent # period of time, in case some log sources are not in real time buffer_time: minutes:15
# The Elasticsearch hostname for metadata writeback # Note that every rule can have its own Elasticsearch host es_host:192.168.2.71
# The Elasticsearch port es_port:9200
# The AWS region to use. Set this when using AWS-managed elasticsearch #aws_region: us-east-1
# The AWS profile to use. Use this if you are using an aws-cli profile. # See http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html # for details #profile: test
# Optional URL prefix for Elasticsearch #es_url_prefix: elasticsearch
# Optional prefix for statsd metrics #statsd_instance_tag: elastalert
# Optional statsd host #statsd_host: dogstatsd
# Connect with TLS to Elasticsearch use_ssl:True
# Verify TLS certificates verify_certs:True
# Show TLS or certificate related warnings ssl_show_warn:True
# GET request with body is the default option for Elasticsearch. # If it fails for some reason, you can pass 'GET', 'POST' or 'source'. # See https://elasticsearch-py.readthedocs.io/en/master/connection.html?highlight=send_get_body_as#transport # for details #es_send_get_body_as: GET
# Option basic-auth username and password for Elasticsearch es_username:elastic es_password:4RQwIyVNCBznV4zXGDhX
# Use SSL authentication with client certificates client_cert must be # a pem file containing both cert and key for client ca_certs:/opt/elastalert/certs/ca.crt #client_cert: /etc/elasticsearch/certs/elasticsearch.crt #client_key: /etc/elasticsearch/certs/elasticsearch.key
# The index on es_host which is used for metadata storage # This can be a unmapped index, but it is recommended that you run # elastalert-create-index to set a mapping writeback_index:elastalert_status
# If an alert fails for some reason, ElastAlert will retry # sending the alert until this time period has elapsed alert_time_limit: days:1
# 輸出結果應該要類似如下 INFO:elastalert:Background configuration change check run at 2023-07-02 17:47 UTC INFO:elastalert:Background alerts thread 0 pending alerts sent at 2023-07-02 17:47 UTC INFO:elastalert:Disabled rules are: [] INFO:elastalert:Sleeping for 59.99996 seconds INFO:elastalert:Queried rule a from 2023-07-02 17:33 UTC to 2023-07-02 17:48 UTC: 0 / 0 hits WARNING:elasticsearch:DELETE https://192.168.2.71:9200/_search/scroll [status:404 request:0.001s] INFO:elastalert:Ran a from 2023-07-02 17:33 UTC to 2023-07-02 17:48 UTC: 0 query hits (0 already seen), 0 matches, 0 alerts sent INFO:elastalert:a range 900
# 先前往 /opt/elastalert/ cd /opt/elastalert # 啟動 docker-compose.yaml 背景執行 docker-compose up -d # 查看 logs docker-compose logs -f elastalert # 輸出結果應該要類似如下 INFO:elastalert:Background configuration change check run at 2023-07-02 17:47 UTC INFO:elastalert:Background alerts thread 0 pending alerts sent at 2023-07-02 17:47 UTC INFO:elastalert:Disabled rules are: [] INFO:elastalert:Sleeping for 59.99996 seconds INFO:elastalert:Queried rule a from 2023-07-02 17:33 UTC to 2023-07-02 17:48 UTC: 0 / 0 hits WARNING:elasticsearch:DELETE https://192.168.2.71:9200/_search/scroll [status:404 request:0.001s] INFO:elastalert:Ran a from 2023-07-02 17:33 UTC to 2023-07-02 17:48 UTC: 0 query hits (0 already seen), 0 matches, 0 alerts sent INFO:elastalert:a range 900
總結
回到文章的開頭想探討的,到目前為止總結如下:
[x] 了解wazuh這套工具是如何做告警?
Ans: Wazuh 本身提供 mail 發訊息功能,但是如果要做更多還是使用 elastic 整合相關告警工具更好
File "/usr/local/lib/python3.11/site-packages/elasticsearch/connection/http_requests.py", line 174, in perform_request raise SSLError("N/A", str(e), e) elasticsearch.exceptions.SSLError: ConnectionError(HTTPSConnectionPool(host='192.168.2.71', port=9200): Max retries exceeded with url: / (Caused by SSLError(PermissionError(13, 'Permission denied')))) caused by: SSLError(HTTPSConnectionPool(host='192.168.2.71', port=9200): Max retries exceeded with url: / (Caused by SSLError(PermissionError(13, 'Permission denied'))))