Beats简介:
Filebeat简介:
部署与运行:
mkdir /itcast/beats
tar -xvf filebeat-6.5.4-linux-x86_
cd filebeat-6.5.4-linux-x86_64 #创建如下配置文件 l
filebeat.inputs:
- type: stdin enabled: true
plate.settings: index.number_of_shards: 3
sole: pretty: true enable: true #启动filebeat
./filebeat -e -l #输入hello运行结果如下:
hello
{ "@timestamp": "2019-01-12T12:50:03.585Z", "@metadata": { #元数据信息 "beat": "filebeat", "type": "doc", "version": "6.5.4" },"source": "", "offset": 0, "message": "hello", #输入的内容 "prospector": { #标准输入勘探器 "type": "stdin" },"input": { #控制台标准输入 "type": "stdin" },"beat": { #beat版本以及主机信息 "name": "itcast01", "hostname": "itcast01", "version": "6.5.4" },"host": { "name": "itcast01" }
}
读取文件:
#配置读取文件项 l filebeat.inputs:
- type: log enabled: true paths: - /itcast/beats/logs/*.log
plate.settings: index.number_of_shards: 3
sole: pretty: true enable: true #启动filebeat
./filebeat -e -l #/haoke/beats/logs下创建a.log文件,并输入如下内容
hello
world #观察filebeat输出
{ "@timestamp": "2019-01-12T14:16:10.192Z","@metadata": { "beat": "filebeat", "type": "doc", "version": "6.5.4" },"host": { "name": "itcast01" },"source": "/haoke/beats/logs/a.log", "offset": 0, "message": "hello", "prospector": { "type": "log" },"input": { "type": "log" },"beat": { "version": "6.5.4", "name": "itcast01","hostname": "itcast01" }
}
{ "@timestamp": "2019-01-12T14:16:10.192Z", "@metadata": { "beat": "filebeat", "type": "doc", "version": "6.5.4" },"prospector": { "type": "log" },"input": { "type": "log" },"beat": { "version": "6.5.4", "name": "itcast01", "hostname": "itcast01" },"host": { "name": "itcast01" },"source": "/haoke/beats/logs/a.log", "offset": 6, "message": "world"
}
自定义字段:
#配置读取文件项 l
filebeat.inputs:
- type: log enabled: true paths: - /itcast/beats/logs/*.log tags: ["web"] #添加自定义tag,便于后续的处理 fields: #添加自定义字段 from: itcast-im fields_under_root: true #true为添加到根节点,false为添加到子节点中
plate.settings: index.number_of_shards: 3
sole: pretty: true enable: true #启动filebeat
./filebeat -e -l #/haoke/beats/logs下创建a.log文件,并输入如下内容
123 #执行效果
{ "@timestamp": "2019-01-12T14:37:19.845Z", "@metadata": { "beat": "filebeat", "type": "doc", "version": "6.5.4" },"offset": 0, "tags": [ "haoke-im" ],"prospector": { "type": "log" },"beat": { "name": "itcast01", "hostnam
本文发布于:2024-02-05 07:35:11,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170727508064519.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |