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

Posted at Nginx Forum: 
https://forum.nginx.org/read.php?2,266793,266793#msg-266793

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Reply via email to