在CentOS中使用Filebeat进行日志解析通常涉及以下几个步骤:
wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.16.3-x86_64.rpm
sudo rpm -vi filebeat-7.16.3-x86_64.rpm
filebeat.yml
文件中配置相应的输入路径:filebeat.inputs:
- type: log
paths:
- /var/log/nginx/access.log
- /var/log/nginx/error.log
filebeat.modules:
- enabled: nginx
log_format main ' remote_addr - remote_user [ time_local ] " request " ' ' status body_bytes_sent " http_referer " " host "' '" http_user_agent " " http_x_forwarded_for "' ;
filebeat test config
通过以上步骤,可以在CentOS系统中成功解析FileBeat收集的日志。如果需要更复杂的日志分析,可以将FileBeat的输出转发到Logstash或Elasticsearch,并使用Kibana进行更高级的分析和可视化。