It would be nice to have the possibility to modify the Nginx access log format by specifying a custom one.
My use case is that I’m using the Nginx module of Filebeat to collect logs generated by the Nginx container, but Filebeat can’t get the server_name because it is not logged by Nginx by default.
Or maybe change the nginx.conf file to include the logging of the server_name
by default.
It should requires the following change :
# Add $host at the beginning of this log line
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
# In order to have this line
log_format main '$host $remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';