【问题标题】:How do I get the number of requests per second from Apache log between 2 dates/time?如何从 Apache 日志中获取 2 个日期/时间之间每秒的请求数?
【发布时间】:2010-10-29 11:53:34
【问题描述】:

我可以使用什么命令来分析 Apache 的日志文件,该文件告诉我在 x 天的上午 11 点和 x 天的下午 13 点之间,每秒的平均请求数是……?操作系统是 linux (red hat)

谢谢

【问题讨论】:

标签: linux apache monitoring network-monitoring


【解决方案1】:

在第 x 天的上午 11 点到下午 13 点之间

我的时钟不会一直到下午 13 点。简易机场 1 的情况如何?

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

类似...

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

【讨论】:

  • 您的(聪明的顺便说一句)脚本测量平均值,而不是峰值 req/s
  • 您没有要求这样做 - 但添加起来很简单。
猜你喜欢
  • 1970-01-01
  • 2010-12-03
  • 1970-01-01
  • 2019-05-07
  • 1970-01-01
  • 2021-09-10
  • 1970-01-01
  • 2014-02-17
  • 2012-03-14
相关资源
最近更新 更多