首页 > 解决方案 > Logstash Elastic Cloud 401 未经授权的错误

问题描述

官方logstash弹性云模块

开始的官方文档

我的logstash.yml样子:

  cloud.id: "Test:testkey"
  cloud.auth: "elastic:password"

前面有 2 个空格,最后没有空格,在""

这就是我所拥有的logstash.yml,没有别的了,
我得到:

[2018-08-29T12:33:52,112][WARN ][logstash.outputs.elasticsearch] Attempted to resurrect connection to dead ES instance, but got an error. {:url=>"https://myserverurl:12345/", :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError, :error=>"Got response code '401' contacting Elasticsearch at URL 'https://myserverurl:12345/'"}

my_config_file_name.conf看起来像:

input{jdbc{...jdbc here... This works, as I see data in windows console}}
output {
    stdout { codec => json_lines }
    elasticsearch {
    hosts => ["myserverurl:12345"]
    index => "my_index"
    # document_id => "%{brand}"
    }

我正在做的是bin/logstash在 windows上点击cmd
它从我在 conf 文件的输入中配置的数据库加载数据,然后显示错误,我想在 Cloud 上索引我的数据MySQLelasticsearch我试用了 14 天并创建了一个测试索引,用于学习目的,因为我稍后必须部署它。我的管道看起来像:

  - pipeline.id: my_id
    path.config: "./config/conf_file_name.conf"
    pipeline.workers: 1

如果日志不包含敏感数据,我也可以提供。 基本上我不想在云上
同步(计划检查)我的MYSQL数据,即ElasticSearchAWS

标签: elasticsearchlogstashelastic-cloud

解决方案


输出应为:

elasticsearch {
    hosts => ["https://yourhost:yourport/"]
    user => "elastic"
    password => "password"
    # protocol => https
    # port => "yourport"
    index => "test_index"
    # document_id => "%{table_id}"

#- 表示

如下所述的评论:Configuring logstash with elastic cloud docs

部署应用程序时提供的文档不提供 jdbc 的配置,即使在设置文件中定义,jdbc 也需要用户和密码,即logstash.yml


推荐阅读