Elasticsearch Filebeat 文档类型已弃用问题

标签 elasticsearch filebeat

我目前正在使用 ELK 5.5。现在看来 document_type 在 Filebeats 中已被弃用,但我现在在任何地方都找不到任何关于如何实现相同的示例。

这是我在日志中得到的:

WARN DEPRECATED: document_type is deprecated. Use fields instead.

这是我当前的 filebeat 配置:
- input_type: log

  # Paths that should be crawled and fetched. Glob based paths.
  paths:
    - C:\inetpub\logs\LogFiles\*\*
  document_type: iislog

  paths:
    - C:\MyApp\logs\*
  document_type: applog

有人可以告诉我如何在使用相同的 5.5 版时重写我的日志并摆脱此弃用消息。顺便说一句,我确实想对两种“文档类型”使用相同的 ES 索引。

最佳答案

而不是使用 document_type ,您可以使用 fields像这样在 Filebeat :

- input_type: log

  # Paths that should be crawled and fetched. Glob based paths.
  paths:
    - C:\inetpub\logs\LogFiles\*\*
  fields:
    service: iislog
  fields_under_root: true 

  paths:
    - C:\MyApp\logs\*
  fields:
    service: applog
  fields_under_root: true

现在,对于 Logstash 输出过滤器,而不是使用 [type]调用document_type,可以使用[service] .这是我在logstash上的使用方式:
output {
  if [service] == "applog" {   
    elasticsearch {
    hosts => ["localhost:9200"]
    user => <user>
    password => <pass>
    index => "applog-%{+YYYY.MM.dd}"
    }   
  }
enter code here

查看下面有关 Filebeat 上自定义字段的更多信息:
https://www.elastic.co/guide/en/beats/filebeat/current/migration-changed-fields.html

关于Elasticsearch Filebeat 文档类型已弃用问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45974963/

相关文章:

elasticsearch - 如何获取达到某个最小日期的不同值的计数

elasticsearch - 使用 NEST 进行多字段的正确方法

python - Elasticsearch 为嵌套数组创建映射

elasticsearch - 如何从Filebeat Shipper转发数据到Power Bi

elasticsearch - 如何从同一filebeat到logstash的不同日志具有不同的索引名称

elasticsearch - 在发送到Logstash/ Elasticsearch 之前,可以编写grok表达式来丰富FileBeat中的日志文件

docker - 使用 Docker 镜像的神秘 Filebeat 7 X-Pack 问题

java - Spring 启动执行器中的 Elasticsearch 运行状况检查有时会返回状态

c# - 使用 NEST 的 ElasticSearch 索引/插入失败

elasticsearch - 如何在 filebeat 5 中强制重建日志数据