nginx日志打印相应时间



nginx日志打印相应时间
 
日志格式:
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
                '$status $body_bytes_sent "$http_referer" '
                '"$http_user_agent" $http_x_forwarded_for "$request_time"';
配置:
        server {
        server_name  test.com;
        root html;
        index  index.html;
        access_log logs/access.log main;
}  www.2cto.com  
 
可以为做性能测试统计平均时间
 
 awk '{sum+=$10;count+=1} END{print "SUM:"sum"\nAVG:"sum/count"\nCOUNT:"count}' access_log2012-08-24.16.log
 
 awk '{a_array[$1]+=$10;b_array[$1]++}END{for(i in a_array) print i":"a_array[i]":"b_array[i]}' access_log2012-08-24.16.log 
 

相关内容

    暂无相关文章