我尝试将以下内容添加到my_proxy.conf
安装到 /etc/nginx/conf.d/
容器中的文件中,如https://github.com/jwilder/nginx-proxy#custom-nginx-configuration中所述,但日志没有进入logstash。
最初我将其添加到 conf 文件中:
http {
# Custom log format that also includes the host that processed the request
log_format logstash '$remote_addr - $remote_user [$time_local] "$host" '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';
# Send logs to Logstash
access_log syslog:server=logstash:5140,tag=nginx_access logstash;
error_log syslog:server=logstash:5140,tag=nginx_error notice;
}
但是当我启动容器时它告诉我"http" directive is not allowed here in /etc/nginx/conf.d/my_proxy.conf:11
所以现在我只有
# Custom log format that also includes the host that processed the request
log_format logstash '$remote_addr - $remote_user [$time_local] "$host" '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';
# Send logs to Logstash
access_log syslog:server=logstash:5140,tag=nginx_access logstash;
error_log syslog:server=logstash:5140,tag=nginx_error notice;
启动 nginx 时没有任何抱怨,但也没有将任何内容放入 logstash。从这里我不知道如何排除故障。