쿠키 기본 설정 선택

당사는 사이트와 서비스를 제공하는 데 필요한 필수 쿠키 및 유사한 도구를 사용합니다. 고객이 사이트를 어떻게 사용하는지 파악하고 개선할 수 있도록 성능 쿠키를 사용해 익명의 통계를 수집합니다. 필수 쿠키는 비활성화할 수 없지만 '사용자 지정' 또는 ‘거부’를 클릭하여 성능 쿠키를 거부할 수 있습니다.

사용자가 동의하는 경우 AWS와 승인된 제3자도 쿠키를 사용하여 유용한 사이트 기능을 제공하고, 사용자의 기본 설정을 기억하고, 관련 광고를 비롯한 관련 콘텐츠를 표시합니다. 필수가 아닌 모든 쿠키를 수락하거나 거부하려면 ‘수락’ 또는 ‘거부’를 클릭하세요. 더 자세한 내용을 선택하려면 ‘사용자 정의’를 클릭하세요.

JSON을 사용한 수동 파티셔닝을 통해 Athena에서 CloudFront 로그용 테이블 생성

포커스 모드
JSON을 사용한 수동 파티셔닝을 통해 Athena에서 CloudFront 로그용 테이블 생성 - Amazon Athena
JSON 형식을 사용해 CloudFront 표준 로그 파일 필드의 테이블 생성
  1. 다음 예제 DDL 문을 복사하여 Athena 콘솔의 쿼리 편집기에 붙여 넣습니다. 예제 명령문은 Amazon CloudFront 개발자 안내서의 표준 로그 파일 필드 섹션에 설명된 로그 파일 필드를 사용합니다. 로그를 저장하는 Amazon S3 버킷의 LOCATION을 수정합니다.

    이 쿼리는 다음 SerDe 속성과 함께 OpenX JSON SerDe를 사용하여 Athena에서 JSON 필드를 올바르게 읽습니다.

    CREATE EXTERNAL TABLE `cf_logs_manual_partition_json`( `date` string , `time` string , `x-edge-location` string , `sc-bytes` string , `c-ip` string , `cs-method` string , `cs(host)` string , `cs-uri-stem` string , `sc-status` string , `cs(referer)` string , `cs(user-agent)` string , `cs-uri-query` string , `cs(cookie)` string , `x-edge-result-type` string , `x-edge-request-id` string , `x-host-header` string , `cs-protocol` string , `cs-bytes` string , `time-taken` string , `x-forwarded-for` string , `ssl-protocol` string , `ssl-cipher` string , `x-edge-response-result-type` string , `cs-protocol-version` string , `fle-status` string , `fle-encrypted-fields` string , `c-port` string , `time-to-first-byte` string , `x-edge-detailed-result-type` string , `sc-content-type` string , `sc-content-len` string , `sc-range-start` string , `sc-range-end` string ) ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe' WITH SERDEPROPERTIES ( 'paths'='c-ip,c-port,cs(Cookie),cs(Host),cs(Referer),cs(User-Agent),cs-bytes,cs-method,cs-protocol,cs-protocol-version,cs-uri-query,cs-uri-stem,date,fle-encrypted-fields,fle-status,sc-bytes,sc-content-len,sc-content-type,sc-range-end,sc-range-start,sc-status,ssl-cipher,ssl-protocol,time,time-taken,time-to-first-byte,x-edge-detailed-result-type,x-edge-location,x-edge-request-id,x-edge-response-result-type,x-edge-result-type,x-forwarded-for,x-host-header') STORED AS INPUTFORMAT 'org.apache.hadoop.mapred.TextInputFormat' OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' LOCATION 's3://amzn-s3-demo-bucket/'
  2. Athena 콘솔에서 쿼리를 실행합니다. 쿼리가 완료된 후 Athena는 cf_logs_manual_partition_json 테이블을 등록하여 쿼리를 실행할 수 있도록 데이터를 준비합니다.

쿼리 예제

다음 쿼리는 2025년 1월 15일까지 CloudFront가 제공한 바이트 수를 합산합니다.

SELECT sum(cast("sc-bytes" as BIGINT)) as sc FROM cf_logs_manual_partition_json WHERE "date"='2025-01-15'

쿼리 결과에서 중복 행(예: 중복된 빈 행)을 제거하려면 다음 예제와 같이 SELECT DISTINCT 문을 사용할 수 있습니다.

SELECT DISTINCT * FROM cf_logs_manual_partition_json

이 페이지에서

프라이버시사이트 이용 약관쿠키 기본 설정
© 2025, Amazon Web Services, Inc. 또는 계열사. All rights reserved.