1.配置filebeat_nginx.yml
1 | filebeat.modules: |
2.启动filebeat
1 | ./filebeat -e -c filebeat_nginx.yml |
3.访问nginx
1 | tail -f /var/log/nginx/access.log |
日志文件输出
1 | {"ts":"2019-10-14 10:53:22","host":"127.0.0.1","clientip":"127.0.0.1","size":0,"responsetime":0.000,"upstreamtime":"-","upstreamhost":"-","http_host":"localhost","url":"/index.html","domain":"localhost","xff":"-","referer":"-","status":"304"} |
kafka输出
1 | {"ts":"2019-10-14 10:53:23","host":"127.0.0.1","clientip":"127.0.0.1","size":0,"responsetime":0.000,"upstreamtime":"-","upstreamhost":"-","http_host":"localhost","url":"/index.html","domain":"localhost","xff":"-","referer":"-","status":"304"} |
如果要采集多个log,并发送到不同的topic的话,参考
1 | https://blog.csdn.net/Z_GodGirl/article/details/81328000 |