我如何获得两个日期/时间之间每秒请求从Apache日志的数量? [英] How do I get the number of requests per second from Apache log between 2 dates/time?

查看:195
本文介绍了我如何获得两个日期/时间之间每秒请求从Apache日志的数量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用什么命令,以分析告诉X到每秒平均请求是天x的11点和日13pm之间我Apache的日志文件..?操作系统是Linux(红帽)

感谢


解决方案

  

天x和13pm的上午11点之间


我的钟不走一路13pm。如何都在简易机场1东西呢?

假设你的意思是下午1点....

喜欢的东西...

 的awk'BEGIN {开始= 0}
   / \\ [29 \\ /月\\ / 2010:11 / {
          开始= 1}
   / \\ [29 \\ /月\\ / 2010:1 [3-9] / {
          打印计数/(2 * 60 * 60);
          出口; }
   // {
          如果(开始)计数++;
      }'<访问日志

What command can I use to analyse Apache's log file that tells me between 11am of day x and 13pm of day x the average request per second was..? The os is linux (red hat)

Thanks

解决方案

between 11am of day x and 13pm

My clock doesn't go all the way to 13pm. How are things on Airstrip 1?

Assuming you meant 1pm....

Something like...

awk 'BEGIN {started=0}
   /\[29\/Oct\/2010:11/ {
          started=1}
   /\[29\/Oct\/2010:1[3-9]/ {
          print count/(2*60*60);
          exit; }
   // { 
          if (started) count++;
      }' <access_log

这篇关于我如何获得两个日期/时间之间每秒请求从Apache日志的数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆