elasticsearch - Filebeat可以在管道中没有logstash的情况下将日志行输出转换为json吗?

标签 elasticsearch logging filebeat

我们的Spring Boot Web应用程序(非json)中有标准的日志行。
我们需要集中日志记录并将其作为json进行 flex 搜索。

(我听说以后的版本可以做一些转换)

Filebeat可以读取日志行并将其包装为json吗?我猜它也可以附加一些元数据。无需解析日志行。

预期产量:{timestamp : "", beat: "", message: "the log line..."}
我没有代码可以显示。

最佳答案

filebeat支持several outputs包括Elastic Search

配置文件filebeat.yml如下所示:

# filebeat options: https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-reference-yml.html

filebeat.inputs:
- type: log
  enabled: true
  paths:
    - /var/log/../file.err.log

processors:
   - drop_fields:
      # Prevent fail of Logstash (https://www.elastic.co/guide/en/beats/libbeat/current/breaking-changes-6.3.html#custom-template-non-versioned-indices)
      fields: ["host"]
   - dissect:
      # tokenizer syntax: https://www.elastic.co/guide/en/logstash/current/plugins-filters-dissect.html.
      tokenizer: "%{} %{} [%{}] {%{}} <%{level}> %{message}"
      field: "message"
      target_prefix: "spring boot"

fields:
  log_type: spring_boot

output.elasticsearch:
  hosts: ["https://localhost:9200"]
  username: "filebeat_internal"
  password: "YOUR_PASSWORD"

关于elasticsearch - Filebeat可以在管道中没有logstash的情况下将日志行输出转换为json吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56556506/

相关文章:

amazon-web-services - FIlebeat-Redis-Logstash : Filebeat fast and Logstah slow, logstash 线程?

elasticsearch - Filebeat 未在 Windows 中启动

elasticsearch - Elasticsearch 将 geohash_grid 键转换为经纬度

elasticsearch - 将大量数据索引到elasticsearch

python - 提速生成器->列表-> Python中的CSV

Elasticsearch 别名有多个写入索引(不是任何其他问题的副本)

python - Django 记录器 - 正确输出到 stdout 和 stderr

javascript - React Native 中的远程错误日志记录

python - 使用 python 日志记录时查找格式错误的来源

elasticsearch - ELK堆栈自定义字段