module.d/nginx.yml
vim /etc/filebeat/modules.d/nginx.yml
- module: nginx
access:
enabled: true
var.paths: ["/nginx/access-*.log"]
error:
enabled: true
var.paths: ["/nginx/error.log*"]
#路径格式参考
/path/to/log/*/*.log
https://www.elastic.co/guide/en/beats/filebeat/current/exported-fields-nginx.html
vim /etc/nginx/nginx.conf
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
[root@nginx02 ~]# tail -f /var/log/nginx/www_access.log
192.168.81.210 - - [21/Jan/2021:15:46:49 +0800] "GET / HTTP/1.1" 200 10 "-" "curl/7.29.0" "-"
https://www.elastic.co/guide/en/beats/filebeat/current/filtering-and-enhancing-data.html
https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-input-httpjson.html