Logstash Elastic Cloud 401 未授权错误

Logstash Elastic Cloud 401 Unauthorized error

Official logstash elastic cloud module

Official doc for starting with

我的 logstash.yml 看起来像:

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

前面有2个space,后面没有space,在""

以内

这就是我在 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}"
    }

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

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

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

输出应为:

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

我在我的开发环境中添加了同样的问题。在 google 上搜索了几个小时后,我默认理解,当您安装 Logstash 时,X-Pack 也会安装。在文档 https://www.elastic.co/guide/en/logstash/current/setup-xpack.html 中指出

Blockquote

X-Pack 是一个 Elastic Stack 扩展,提供安全、警报、监控、机器学习、管道管理和许多其他功能

Blockquote

因为我在流式传输 Elasticsearch 时不需要在我的开发中 运行 x-pack,所以我不得不通过设置 ilm_enabled[=24= 来禁用它] 在我的索引文件配置的输出中设置为 false。

    output {
     elasticsearch { 
        hosts =>  [.. ]
        ilm_enabled => false
      }
    }

下面的 link 可能会有所帮助 https://discuss.opendistrocommunity.dev/t/logstash-oss-with-non-removable-x-pack/655/3