filebeat

filebeat

filebeat 是基于原先 logstash-forwarder 的源码改造出来的。换句话说:filebeat 就是新版的 logstash-forwarder,也会是 Elastic Stack 在 shipper 端的第一选择。

安装部署

注意

可能需要额外授予执行权限。命令为:PowerShell.exe -ExecutionPolicy RemoteSigned -File .\install-service-filebeat.ps1.

filebeat 配置

所有的 beats 组件在 output 方面的配置都是一致的,之前章节已经介绍过。这里只介绍 filebeat 在 input 段的配置,如下:

我们已完成了配置,当 sudo service filebeat start 之后,你就可以在 kibana 上看到你的日志了。

字段

Filebeat 发送的日志,会包含以下字段:

  • beat.hostname beat 运行的主机名

  • beat.name shipper 配置段设置的 name,如果没设置,等于 beat.hostname

  • @timestamp 读取到该行内容的时间

  • type 通过 document_type 设定的内容

  • input_type 来自 "log" 还是 "stdin"

  • source 具体的文件名全路径

  • offset 该行日志的起始偏移量

  • message 日志内容

  • fields 添加的其他固定字段都存在这个对象里面

Last updated

Was this helpful?