설명
API Gateway에서 처리가 끝나 애플리케이션까지 도달하지 않는 요청도 REST API 액세스 로그에는 기록할 수 있습니다.
잠재적 영향
애플리케이션 로그만 보면 실패한 요청이나 의심스러운 호출의 기록을 놓칠 수 있습니다.
해결 방법
provider.logs.restApi.accessLogging: true를 지정하고 로그 형식에 요청 ID를 포함하세요. 전송 권한과 보존 기간을 설정하고 비밀정보와 불필요한 요청 본문은 제외하세요.
예시
예시는 Framework가 만든 API에서 $context.requestId를 기록합니다. provider.apiGateway.restApiId로 가져온 API는 해당 스테이지에서 로깅을 설정하세요.
변경 전
yaml
provider:
name: aws
logs:
restApi:
accessLogging: false
format: 'requestId: $context.requestId'
변경 후
yaml
provider:
name: aws
logs:
restApi:
accessLogging: true
format: 'requestId: $context.requestId'