首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 其他相关 >

nginx日记打印相应时间

2012-09-21 
nginx日志打印相应时间日志式:log_format main $remote_addr - $remote_user [$time_local] $request

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;

}


可以为做性能测试统计平均时间

 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 

热点排行