filebeat启动
- 前台启动:
bash
/usr/local/fb/filebeat -e -c /usr/local/fb/filebeat.yml
- 后台启动:
bash
nohup /usr/local/fb/filebeat -e -c /usr/local/fb/filebeat.yml > /dev/null 2>&1 &
input 配置 && output配置
- input配置
yaml
- type: log
enabled: true
paths:
- /var/fb/log/pe.log
fields:
topic: "wlinfo"
json.keys_under_root: true
json.overwrite_keys: true
- output配置
yaml
output.kafka:
hosts: ["192.168.110.49:9092"]
topic: '%{[fields.topic]}'
required_acks: 1
compression: gzip
max_message_bytes: 1000000
max_retry: 3
timeout: 30s
- 启动校验
使用 filebeat test config 和 filebeat test output 命令验证配置,确保事件结构正确。可以先用 filebeat test config 看看是否能通过配置检查。