diff --git a/conf.d/log.conf b/conf.d/log.conf new file mode 100644 index 0000000..18a4322 --- /dev/null +++ b/conf.d/log.conf @@ -0,0 +1,23 @@ +# definiere mehrere Formate für logfiles +# Format main bindet gegenüber dem Default von nginx http_x_forwarded_for, gzip_ratio, request_time, upstream_response_time und pipe ein +log_format main '$remote_addr - $remote_user [$time_local] ' + '"$request" $status $bytes_sent ' + '"$http_referer" "$http_user_agent" "$http_x_forwarded_for" ' + '"$gzip_ratio" "$request_time" "$upstream_response_time" "$pipe"'; + +# das selbe Format nochmal nur mit ausgetauschter IP-Adresse +log_format ano '0.0.0.0 - $remote_user [$time_local] ' + '"$request" $status $bytes_sent ' + '"$http_referer" "$http_user_agent" "$http_x_forwarded_for" ' + '"$gzip_ratio" "$request_time" "$upstream_response_time" "$pipe"'; + +# dieses Format ist für revers-proxy gedacht um mehr informationen über den Cache Zustand bei der Anfrage zu erhalten +log_format cache '$time_local $upstream_cache_status ' + 'Cache-Control: $upstream_http_cache_control ' + 'Expires: $upstream_http_expires ' + '"$request" ($status) "$gzip_ratio" ' + '"$request_time" "$upstream_response_time" "$pipe"'; + +access_log /var/log/nginx/access.log main; +error_log /var/log/nginx/error.log warn; + diff --git a/nginx.conf b/nginx.conf index e80e34f..f1937aa 100644 --- a/nginx.conf +++ b/nginx.conf @@ -15,30 +15,6 @@ http { include /etc/nginx/mime.types; default_type application/octet-stream; - - # definiere mehrere Formate für logfiles - # Format main bindet gegen über dem Default http_x_forwarded_for, gzip_ratio, zeiten und pipe usw. - log_format main '$remote_addr - $remote_user [$time_local] ' - '"$request" $status $bytes_sent ' - '"$http_referer" "$http_user_agent" "$http_x_forwarded_for" ' - '"$gzip_ratio" "$request_time" "$upstream_response_time" "$pipe"'; - - # das selbe Format nochmal nur mit ausgtauschter Fake IP - log_format ano '0.0.0.0 - $remote_user [$time_local] ' - '"$request" $status $bytes_sent ' - '"$http_referer" "$http_user_agent" "$http_x_forwarded_for" ' - '"$gzip_ratio" "$request_time" "$upstream_response_time" "$pipe"'; - - # dieses Format ist für revers-proxy gedacht um mehr informationen über den Cache Zustand bei der Anfrage zu erhalten - log_format cache '$time_local $upstream_cache_status ' - 'Cache-Control: $upstream_http_cache_control ' - 'Expires: $upstream_http_expires ' - '"$request" ($status) "$gzip_ratio" ' - '"$request_time" "$upstream_response_time" "$pipe"'; - - - access_log /var/log/nginx/access.log main; - upstream ro01 { server [2001:470:6c:655::2] weight=10; server local.krautspace.de weight=1;