我正在尝试使用 Graylog 收集 nginx 错误和访问日志,我认为一切都已正确配置,但 Graylog 未从 NGINX 收到任何信息(Graylog 和 NGINX 在 docker 容器中,并且都在同一网络中)
我使用 nginx/1.13.5 & Graylog 2.4.0 并且我在 graylog 上使用这个内容包
这是我的 nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
log_format graylog2_json escape=json '{ "timestamp": "$time_iso8601", '
'"remote_addr": "$remote_addr", '
'"remote_user": "$remote_user", '
'"body_bytes_sent": $body_bytes_sent, '
'"request_time": $request_time, '
'"status": $status, …
Run Code Online (Sandbox Code Playgroud)