apacheの時間毎のアクセス数

ログのフォーマット

127.0.0.1 - - [08/Mar/2022:14:51:04 +0900] "GET /noindex/css/bootstrap.min.css HTTP/1.1" 200 19341 "http://localhost/" "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0"


sedで年月日、時刻、分を抽出し、uniqコマンドで件数を出力する

$ cat /var/log/httpd/access_log-20220311 | sed -nE 's/^[^\[]+\[([0-9]{2}\/[A-Za-z]+\/[0-9]{4}\:[0-9]{2}\:[0-9]{2})\:.+$/\1/p' | uniq -c
      2 08/Mar/2022:13:38
     13 08/Mar/2022:13:41
      2 08/Mar/2022:13:46
      2 08/Mar/2022:13:47
      4 08/Mar/2022:13:55
      2 08/Mar/2022:13:57
      2 08/Mar/2022:13:58
      5 08/Mar/2022:13:59
      4 08/Mar/2022:14:00
      1 08/Mar/2022:14:24
      1 08/Mar/2022:14:45
     10 08/Mar/2022:14:46
      4 08/Mar/2022:14:47
      6 08/Mar/2022:14:49
      5 08/Mar/2022:14:50
     18 08/Mar/2022:14:51
      9 08/Mar/2022:14:52
     12 08/Mar/2022:14:53
      4 08/Mar/2022:14:54
      5 08/Mar/2022:14:56
      5 08/Mar/2022:14:57
      2 08/Mar/2022:15:05
      4 08/Mar/2022:15:06
      5 08/Mar/2022:15:07
      5 08/Mar/2022:15:12
      2 09/Mar/2022:15:16
      3 09/Mar/2022:15:20