Эти респонсы забивают логи мусором. Хотелось бы от них избавиться. Но вот избавляюсь уже несколько дней и все никак.
Для примера за день у меня такая статистика:
Код: Выделить всё
400 122540
200 2216
301 84
404 48
304 9
302 3
206 1
Логи. Меня тут смущает поле request с каким-то мусором.
Код: Выделить всё
{
"timestamp": "2020-03-07T20:00:02+01:00",
"remote_addr": "xx.xxx.xx.xx",
"connection": "267373",
"connection_requests": 1,
"pipe": ".",
"body_bytes_sent": 150,
"request_length": 0,
"request_time": 0.122,
"response_status": 400,
"request": "5:�1���6W�\u0017�<B��/��",
"request_method": "",
"host": "example.com",
"upstream_cache_status": "",
"upstream_addr": "",
"http_x_forwarded_for": "",
"http_referrer": "",
"http_user_agent": "",
"http_version": "",
"remote_user": "",
"http_x_forwarded_proto": "",
"upstream_response_time": "",
"nginx_access": true
}
{
"timestamp": "2020-03-07T20:00:02+01:00",
"remote_addr": "xx.xxx.xx.xx",
"connection": "267376",
"connection_requests": 1,
"pipe": ".",
"body_bytes_sent": 150,
"request_length": 0,
"request_time": 0.123,
"response_status": 400,
"request": "\u001a/�¸)\u0000lu� �\u0006\u0018�������Jx���C\"�/\u0004����~\u000b\u0013Y-���>>��\u0003�\b��\u001a�xy̒�|ۦ]_NO�5� N���ٛ\u00
11��;<I@��ئ��WY\u0017��'G�\u0000#",
"request_method": "",
"host": "example.com",
"upstream_cache_status": "",
"upstream_addr": "",
"http_x_forwarded_for": "",
"http_referrer": "",
"http_user_agent": "",
"http_version": "",
"remote_user": "",
"http_x_forwarded_proto": "",
"upstream_response_time": "",
"nginx_access": true
}
Код: Выделить всё
{
"timestamp": "2020-03-07T20:23:34+01:00",
"remote_addr": "xxx.xxx.xxx.xxx",
"connection": "278064",
"connection_requests": 46,
"pipe": ".",
"body_bytes_sent": 1584,
"request_length": 67,
"request_time": 0.001,
"response_status": 200,
"request": "GET /static/images/icon.png HTTP/2.0",
"request_method": "GET",
"host": "example.com",
"upstream_cache_status": "",
"upstream_addr": "",
"http_x_forwarded_for": "",
"http_referrer": "",
"http_user_agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0",
"http_version": "HTTP/2.0",
"remote_user": "",
"http_x_forwarded_proto": "",
"upstream_response_time": "",
"nginx_access": true
}
Код: Выделить всё
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
multi_accept on;
}
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"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
types_hash_max_size 2048;
keepalive_timeout 300;
keepalive_requests 100;
reset_timedout_connection on;
client_body_timeout 10;
send_timeout 2;
server_tokens off;
large_client_header_buffers 16 256k; # тут я экспериментировал с буферами, поэтому они такие конские
client_header_buffer_size 256k;
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
}
Код: Выделить всё
server {
listen 80 ;
server_name example.com;
return 301 https://example.com$request_uri;
}
server {
listen 443 ssl http2;
server_name example.com;
charset utf-8;
sendfile on ;
tcp_nopush on ;
tcp_nodelay on ;
aio threads ;
access_log /var/log/nginx/example.com.access.json.log gelf_json;
error_log /var/log/nginx/example.com.error.json.log warn;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem ;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem ;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:TLS:2m;
ssl_session_timeout 2m;
ssl_dhparam /etc/nginx/ssl/dh4096.pem;
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA512:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:ECDH+AESGCM:ECDH+AES2
56:DH+AESGCM:DH+AES256:RSA+AESGCM:!aNULL:!eNULL:!LOW:!RC4:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS;
location = /favicon.ico { access_log off; log_not_found off; return 301 https://example.com/static/images/favicon.ico; }
location / {
limit_req zone=mylimit burst=20;
uwsgi_pass uwsgi_api;
uwsgi_param Host $host;
uwsgi_param X-Real-IP $remote_addr;
uwsgi_param X-Forwarded-For $proxy_add_x_forwarded_for;
uwsgi_param UWSGI_SCHEME $scheme;
uwsgi_pass_request_body on;
include uwsgi_params;
}
}