【发布时间】:2021-02-05 12:01:54
【问题描述】:
我有一个边车容器配置为收集我的应用容器的日志。
我首先使用以下配置测试了我的fleunt.conf:
<source>
@type forward
bind "127.0.0.1"
port 24224
<parse>
@type json
</parse>
</source>
<match app.default>
@type stdout
</match>
当我使用 kubectl 在我的 pod 中跟踪 fluentd 容器的日志时,它运行良好,我可以看到我的应用程序日志为 JSON 格式。
现在,我正在尝试将日志发送到 elasticsearch。这是我的fluent.conf:
<source>
@type forward
bind "127.0.0.1"
port 24224
<parse>
@type json
</parse>
</source>
<match app.default>
@type elasticsearch
host "elasticsearch_host"
port 9200
index_name "app-log"
user "log_user"
password xxxxxx
</match>
fluentd 容器在我的 pod 内运行良好,但我无法定义我在 Kibana 的 fluetn.conf 中配置的索引。看起来索引模式没有加载到elasticsearch。
fluentd 容器显示以下警告:
2020-10-22 12:31:10 +0000 [info]: parsing config file is succeeded path="/fluentd/etc/fluent.conf"
2020-10-22 12:31:10 +0000 [info]: gem 'fluent-plugin-elasticsearch' version '4.0.0'
2020-10-22 12:31:10 +0000 [info]: gem 'fluentd' version '1.10.4'
2020-10-22 12:31:12 +0000 [info]: using configuration file: <ROOT>
<source>
@type forward
bind "127.0.0.1"
port 24224
<parse>
@type json
</parse>
</source>
<match app.default>
@type elasticsearch
host "elasticsearch_host"
port 9200
index_name "app-log"
user "log_user"
password xxxxxx
</match>
</ROOT>
2020-10-22 12:31:12 +0000 [info]: starting fluentd-1.10.4 pid=8 ruby="2.5.8"
2020-10-22 12:31:12 +0000 [info]: spawn command to main: cmdline=["/usr/bin/ruby", "-Eascii-8bit:ascii-8bit", "/usr/bin/fluentd", "-c", "/fluentd/etc/fluent.conf", "-p", "/fluentd/plugins", "--under-supervisor"]
2020-10-22 12:31:16 +0000 [info]: adding match pattern="app.default" type="elasticsearch"
2020-10-22 12:31:17 +0000 [warn]: #0 Detected ES 7.x: `_doc` will be used as the document `_type`.
2020-10-22 12:31:17 +0000 [info]: adding source type="forward"
2020-10-22 12:31:17 +0000 [warn]: section <parse> is not used in <source> of forward plugin
2020-10-22 12:31:17 +0000 [info]: #0 starting fluentd worker pid=22 ppid=8 worker=0
2020-10-22 12:31:17 +0000 [info]: #0 listening port port=24224 bind="127.0.0.1"
2020-10-22 12:31:17 +0000 [info]: #0 fluentd worker is now running worker=0
warning: 299 Elasticsearch-7.5.0-e9ccaed468e2fac2275a3761849cbee64b39519f "[types removal] Specifying types in bulk requests is deprecated."
warning: 299 Elasticsearch-7.5.0-e9ccaed468e2fac2275a3761849cbee64b39519f "[types removal] Specifying types in bulk requests is deprecated."
warning: 299 Elasticsearch-7.5.0-e9ccaed468e2fac2275a3761849cbee64b39519f "[types removal] Specifying types in bulk requests is deprecated."
我如何摆脱这个警告"[types removal] Specifying types in bulk requests is deprecated."? fluent.conf 是否有任何其他配置可以帮助我克服这个问题?
我尝试在配置中使用suppress_type_name true,但没有成功。
【问题讨论】:
-
对
suppress_type_name true的支持仅在插件版本 4.0.9 之后添加,因为此问题描述为:github.com/uken/fluent-plugin-elasticsearch/issues/766。根据日志,您正在运行 4.0.0,因此在配置中升级和设置标志应该可以消除警告。但是,没有解释为什么“索引模式没有加载到弹性搜索中”。你能澄清那部分吗? -
@Björn Marschollek 当我在创建索引模式时尝试定义索引模式(即“app-log”)时,它与任何索引都不匹配。我不确定为什么会这样。我想知道是不是因为这个警告。
-
警告不应该影响批量请求。也许尝试按照插件自述文件中的说明启用调试日志记录。
-
好的,我想通了,是用户权限问题。我用来发送日志的 user_id 没有创建索引的权限。
-
@BjörnMarschollek 你能把你的评论作为答案让我接受吗。
标签: elasticsearch fluentd