Welcome! Log In Create A New Profile

Advanced

change client_body_buffer_size from 16K to 256K made the nginx logs size from 50M to 1G..

May 11, 2016 01:39AM
Hi Team,

I always use below configuration to record the post date of my webserver (for security resaon)


http {

...

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
log_format plog '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" "$request_body"';

server {
....

location ~ \.php$ {
try_files $uri =404;
if ($request_method = POST){
return 484;
break;
}
error_page 484 = @post;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
fastcgi_pass backend;
}
location @post{
internal;
access_log /web/log/post.log plog;
try_files $uri =404;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
fastcgi_pass backend;
}
}
}


And today I found that the size the post.log was almost 1G everyday, in the past it's only 50M. The only thing I changed recently is the buffer_size

From :

client_header_buffer_size 64k;
large_client_header_buffers 4 32k;
client_body_buffer_size 16k;
client_max_body_size 50m;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;

To:
client_header_buffer_size 4k;
large_client_header_buffers 4 32k;
client_body_buffer_size 256k;
client_max_body_size 8m;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;


Is that because I changed client_body_buffer_size from 16K to 256K caused the size change of the log file?
For now the client_body_buffer_size is big enough, when users upload a file, then nginx will put it into the buffer instead of a temp file, and then also write this file into post.log? Am I right?

If I'm right, then how can I exclude file upload from the post log? The $request_uri for the upload is mod=swfupload.

Can anyone help?

Thanks
Subject Author Posted

change client_body_buffer_size from 16K to 256K made the nginx logs size from 50M to 1G..

meteor8488 May 11, 2016 01:39AM

Re: change client_body_buffer_size from 16K to 256K made the nginx logs size from 50M to 1G..

Francis Daly May 11, 2016 03:38AM

Re: change client_body_buffer_size from 16K to 256K made the nginx logs size from 50M to 1G..

meteor8488 May 11, 2016 07:26AM

Re: change client_body_buffer_size from 16K to 256K made the nginx logs size from 50M to 1G..

meteor8488 May 11, 2016 09:19AM

Re: change client_body_buffer_size from 16K to 256K made the nginx logs size from 50M to 1G..

Valentin V. Bartenev May 11, 2016 09:52AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 257
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready