【问题标题】:how do i fix Docker ELK stack logstash import connection error我如何修复Docker ELK堆栈logstash导入连接错误
【发布时间】:2020-04-03 21:50:52
【问题描述】:

我在尝试使用日志存储将 CSV 文件导入弹性搜索实例时遇到问题。 我正在使用预配置的 Docker ELK 堆栈。

我在运行命令时收到的错误如下:

D:\data_sets\logstac config>docker cp CVEimport.conf 80:/

D:\data_sets\logstac config>docker exec -it 80 /bin/bash
bash-4.2$ logstash -f /CVEimport.conf --path.data ./storage/
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.headius.backport9.modules.Modules (file:/usr/share/logstash/logstash-core/lib/jars/jruby-complete-9.2.9.0.jar) to method sun.nio.ch.NativeThread.signal(long)
WARNING: Please consider reporting this to the maintainers of com.headius.backport9.modules.Modules
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Sending Logstash logs to /usr/share/logstash/logs which is now configured via log4j2.properties
[2020-04-03T12:35:08,901][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2020-04-03T12:35:08,921][INFO ][logstash.runner          ] Starting Logstash {"logstash.version"=>"7.6.0"}
[2020-04-03T12:35:10,957][INFO ][logstash.licensechecker.licensereader] Elasticsearch pool URLs updated {:changes=>{:removed=>[], :added=>[http://elastic:xxxxxx@elasticsearch:9200/]}}
[2020-04-03T12:35:12,083][WARN ][logstash.licensechecker.licensereader] Restored connection to ES instance {:url=>"http://elastic:xxxxxx@elasticsearch:9200/"}
[2020-04-03T12:35:12,333][INFO ][logstash.licensechecker.licensereader] ES Output version determined {:es_version=>7}
[2020-04-03T12:35:12,349][WARN ][logstash.licensechecker.licensereader] Detected a 6.x and above cluster: the `type` event field won't be used to determine the document _type {:es_version=>7}
[2020-04-03T12:35:13,001][INFO ][logstash.monitoring.internalpipelinesource] Monitoring License OK
[2020-04-03T12:35:13,007][INFO ][logstash.monitoring.internalpipelinesource] Validated license for monitoring. Enabling monitoring pipeline.
[2020-04-03T12:35:15,226][INFO ][org.reflections.Reflections] Reflections took 187 ms to scan 1 urls, producing 20 keys and 40 values
[2020-04-03T12:35:16,318][INFO ][logstash.outputs.elasticsearch][main] Elasticsearch pool URLs updated {:changes=>{:removed=>[], :added=>[http://elastic:xxxxxx@127.0.0.1:9200/]}}
[2020-04-03T12:35:16,375][WARN ][logstash.outputs.elasticsearch][main] Attempted to resurrect connection to dead ES instance, but got an error. {:url=>"http://elastic:xxxxxx@127.0.0.1:9200/", :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :error=>"Elasticsearch Unreachable: [http://elastic:xxxxxx@127.0.0.1:9200/][Manticore::SocketException] Connection refused (Connection refused)"}

然后它继续尝试重新连接。

我的配置文件是:

    input {

    file {
        path => ["/CVEDB1.csv"]
        start_position => "beginning"
        sincedb_path => "/dev/null"

    }
}

filter {
        csv {
        columns=> ["Name","Status","Description","References","Phase","Votes","Comments"]
        separator => ","
        }
}

output {

    elasticsearch {
    hosts => "http://127.0.0.1:9200"
    index => "cve"
    user => "elastic"
    password => "changeme"
    }
    stdout{}
}

任何信息都会有所帮助,因为我是 ELK 堆栈的新手。

【问题讨论】:

    标签: elasticsearch logstash kibana elastic-stack elk


    【解决方案1】:

    您是否正在运行 Elasticsearch REST 服务?

    # are we green?
    curl http://localhost:9200/_cluster/health?pretty
    

    如果你想独立测试logstash,你可以将输出发送到控制台

    # output to console
    output {
      stdout { codec => rubydebug }
    }
    

    注意。只要您没有保护 Elasticsearch 集群,就不需要用户名和密码。

    注意。运行docker时

    容器(本地主机)!=主机(本地主机)。

    1. 您可以在 host_mode 下运行 Elasticsearch
    2. 利用 docker-compose 并建立服务发现。
    3. curl http://172.16.0.2/_cluster/health?pretty (docker0 子网)

    【讨论】:

    • 我的弹性搜索上有一个用户名和密码,因为这就是它在图像中的方式。弹性搜索的状态显示为“黄色”。看起来是因为它有 14 个未分配的分片。
    • 更详细的错误看这里[pastebin.com/84krefww]
    • 问题是我使用的 IP 对导入不正确。我的错误我显然并不像我想要的那样了解 docker。谢谢
    猜你喜欢
    • 2019-03-28
    • 1970-01-01
    • 2019-08-16
    • 1970-01-01
    • 1970-01-01
    • 2019-06-14
    • 1970-01-01
    • 2019-09-08
    • 1970-01-01
    相关资源
    最近更新 更多