Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ALBのアクセスログをAthenaで分析してSLOをゆるく決める

iwamot
October 17, 2023

 ALBのアクセスログをAthenaで分析してSLOをゆるく決める

2023-10-18
JAWS-UG SRE⽀部 #7 AWSでゆるSRE︕LT⼤会
https://jawsug-sre.connpass.com/event/291843/

iwamot

October 17, 2023
Tweet

More Decks by iwamot

Other Decks in Technology

Transcript

  1. 可用性分析 SELECT http_method, path, count(*) AS total_count, count_if(is_bad_for_availability) AS bad_count,

    100.0 * (count(*) - count_if(is_bad_for_availability)) / count(*) AS availability FROM ( SELECT request_verb AS http_method, url_extract_path(request_url) AS path, (elb_status_code >= 500 OR elb_status_code = 429) AS is_bad_for_availability FROM [ログテーブル名] WHERE day >= date_format(date_add('day', -28, current_timestamp), '%Y/%m/%d') AND from_iso8601_timestamp(time) >= date_add('day', -28, current_timestamp) ) t GROUP BY http_method, path ORDER BY count(*) DESC LIMIT 10
  2. レイテンシ分析 SELECT http_method, path, count(*) AS total_count, approx_percentile(latency, 0.5) AS

    latency_p50, approx_percentile(latency, 0.95) AS latency_p95 FROM ( SELECT request_verb AS http_method, url_extract_path(request_url) AS path, request_processing_time + target_processing_time + response_processing_time AS latency FROM [ログテーブル名] WHERE day >= date_format(date_add('day', -28, current_timestamp), '%Y/%m/%d') AND from_iso8601_timestamp(time) >= date_add('day', -28, current_timestamp) AND (elb_status_code < 500 AND elb_status_code <> 429) AND (request_processing_time + target_processing_time + response_processing_time) > 0 ) t GROUP BY http_method, path ORDER BY count(*) DESC LIMIT 10