logstash不将日志推送到AWS Elasticsearch

时间:2018-07-06 05:49:57

标签: elasticsearch logstash

我正在尝试将日志从logstash推送到elasticsearch,但是失败了。这是我的logstash.conf文件:

input {
            file {
                    path => "D:/shweta/ELK_poc/test3.txt"
                    start_position => "beginning"
                    sincedb_path => "NUL"
                    ignore_older => 0
                }}

    output {
        elasticsearch {
            hosts => [ "https://search-test-domain2-2msy6ufh2vl2ztfulhrtoat6hu.us-west-2.es.amazonaws.com" ]
            index => "testindex4-5july"
            document_type => "test-file"
        }
    } 

我在主机中提供的ES端点是open,因此不应出现访问问题,但仍会出现以下错误:

_[2018-07-05T13:59:05,753][INFO ][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck_url=>https://search-test-domain2-2msy6ufh2vl2ztfulhrtoat6hu.us-west-2.es.amazonaws.com:9200/, :path=>"/"}_
_[2018-07-05T13:59:05,769][WARN ][logstash.outputs.elasticsearch] Attempted to resurrect connection to dead ES instance, but got an error. {:url=>"https://search-test-domain2-2msy6ufh2vl2ztfulhrtoat6hu.us-west-2.es.amazonaws.com:9200/", :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :error=>"Elasticsearch Unreachable: [https://search-test-domain2-2msy6ufh2vl2ztfulhrtoat6hu.us-west-2.es.amazonaws.com:9200/][Manticore::ResolutionFailure] This is usually a temporary error during hostname resolution and means that the local server did not receive a response from an authoritative server (search-test-domain2-2msy6ufh2vl2ztfulhrtoat6hu.us-west-2.es.amazonaws.com)"}_

我被困在这里。但是,当我下载ES并将其安装到我的计算机中并在本地运行时,在输出中将主机替换为hosts => [ "localhost:9200" ],它可以很好地将数据推送到本地es:

我尝试了很多方法,但无法解决问题,请任何人帮助。我不想提供本地主机,但要提供AWS ES域终端节点。任何提示或线索将不胜感激

预先感谢 Shweta

1 个答案:

答案 0 :(得分:1)

我认为,您只需要显式添加端口443,它就可以工作。如果没有明确指定端口,我认为是elasticsearch输出插件automatically uses port 9200

    elasticsearch {
        hosts => [ "https://search-test-domain2-2msy6ufh2vl2ztfulhrtoat6hu.us-west-2.es.amazonaws.com:443" ]
        index => "testindex4-5july"
        document_type => "test-file"
    }

另一种选择是不添加端口,而是按照official AWS ES docs

中的说明指定ssl => true
    elasticsearch {
        hosts => [ "https://search-test-domain2-2msy6ufh2vl2ztfulhrtoat6hu.us-west-2.es.amazonaws.com" ]
        index => "testindex4-5july"
        document_type => "test-file"
        ssl => true
    }