Skip to content

Commit 64409dc

Browse files
author
Bryan Latten
committed
Merge pull request #22 from bryanlatten/feature-nginx-min-logs
Nginx con: adding optional minimal logging
2 parents ae0a6f9 + 6a205fa commit 64409dc

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.git/*

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Variable | Example | Description
1111
`SERVER_SENDFILE` | `SERVER_SENDFILE=off` | Allows runtime to specify value of nginx's `sendfile` (default, on)
1212
`SERVER_KEEPALIVE` | `SERVER_KEEPALIVE=30` | Define HTTP 1.1's keepalive timeout
1313
`SERVER_WORKER_CONNECTIONS` | `SERVER_WORKER_CONNECTIONS=2048` | Sets up the number of connections for worker processes
14+
`SERVER_LOG_MINIMAL` | `SERVER_LOG_MINIMAL=1` | Minimize the logging format, appropriate for development environments
1415

1516

1617
### Runtime Commands

container/root/etc/nginx/nginx.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ http {
2626
'$status $body_bytes_sent "$http_referer" '
2727
'"$http_user_agent" "$http_x_forwarded_for" NGINX_SERVER';
2828

29+
log_format minimal '$request_method $request_uri $status';
30+
2931
error_log /dev/stdout info;
3032
access_log /dev/stdout main;
3133

container/root/run.d/10-nginx.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,11 @@ then
4444
echo "[nginx] setting worker connection limit ${SERVER_WORKER_CONNECTIONS}"
4545
sed -i "s/\worker_connections .*;/worker_connections ${SERVER_WORKER_CONNECTIONS};/" $CONF_NGINX_SERVER
4646
fi
47+
48+
if [[ $SERVER_LOG_MINIMAL ]]
49+
then
50+
echo "[nginx] enabling minimal logging"
51+
# Uncomments all gzip handling options
52+
sed -i "s/access_log \/dev\/stdout .*;/access_log \/dev\/stdout minimal;/" $CONF_NGINX_SERVER
53+
fi
54+

0 commit comments

Comments
 (0)