S3 のサーバアクセスログから、Athena を使って日毎のリクエスト数を取得する
DB、テーブルは作成済みの前提
GET、SELECT、他のすべてのリクエスト
SELECT regexp_extract(time, '\d{2}/\w+/\d{4}') AS by_day
, count(*) AS cnt
FROM s3_accesslog
WHERE (operation NOT LIKE '%PUT%'
AND operation NOT LIKE '%POST%'
AND operation NOT LIKE '%COPY%'
AND operation NOT LIKE '%LIST%')
GROUP BY regexp_extract(time,'\d{2}/\w+/\d{4}')
ORDER BY by_day
PUT、COPY、POST、LIST リクエスト
SELECT regexp_extract(time, '\d{2}/\w+/\d{4}') AS by_day
, count(*) AS cnt
FROM s3_accesslog
WHERE (operation LIKE '%PUT%'
OR operation LIKE '%POST%'
OR operation LIKE '%COPY%'
OR operation LIKE '%LIST%')
GROUP BY regexp_extract(time,'\d{2}/\w+/\d{4}')
ORDER BY by_day
参考サイト
Author And Source
この問題について(S3 のサーバアクセスログから、Athena を使って日毎のリクエスト数を取得する), 我々は、より多くの情報をここで見つけました https://qiita.com/oppara/items/0dad82513808703e8245著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .