Skip to content

ilogtail采集容器日志输出到elasticsearch es收不到日志 #776

Answered by shalousun
xiaoyang2008mmm asked this question in Help
Discussion options

You must be logged in to vote

es服务端在使用basic auth作为认证的情况下xpack.security.enabled=true设置为true是没有问题的。
只是flusher在配置Addresses时需要带上连接协议的前缀

flushers:
  - Type: flusher_elasticsearch
    Addresses:
      - http://192.168.10.92:9200
    Index: grow
    Authentication:
      PlainText:
        Username: "elastic"
        Password: "elastic"

对于不带协议的情况下es官方的go client会出现下面类似的错误:

 cannot create client: cannot parse url: parse "127.0.0.1:9200": first path segment in URL cannot contain colon

官方es go client例子中也是加了前缀的

cfg := elasticsearch.Config{
  Addresses: []string{
    "https://localhost:9200",
    "https://localhost:9201",
  },
  Username: "foo",
  Password: "bar",
}
es, err := elasticsearch.NewClient(cfg)

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@q121102302
Comment options

Comment options

You must be logged in to vote
1 reply
@Shylcok
Comment options

Answer selected by messixukejia
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
question Further information is requested
5 participants
Converted from issue

This discussion was converted from issue #774 on April 08, 2023 02:11.