How to extract request headers for APIGW using CloudWatch Logs?

0

I have created a Rest APIGW and created a log group in Cloud Watch and configured a logs in log format.

Now, making a get call to APIGW. In headers I am sending TransactionID. How to capture this header in Logs. Please find below attached screenshot. Enter image description here

I am able to capture rest of the logs. Is there any context variable to extract headers in log format?

1개 답변
0

In order to see Headers in APIGW logs you need to follow below steps

  1. Go to your APIGW ID
  2. Go to stages ===> logs/tracing
  3. Enable CloudWatch logs with INFO level logging and you must Enable Log full requests/responses data Execution logs for APIGW After configuring like above , you will be able to see the headers in APIGW execution logs

Attaching some references:

[1] --- https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html#:~:text=User%20Guide.-,Set%20up%20CloudWatch%20API%20logging%20using%20the%20API%20Gateway%20console,-To%20set%20up

[2] --- https://aws.amazon.com/premiumsupport/knowledge-center/api-gateway-cloudwatch-logs/

AWS
답변함 2년 전
  • Thanks for your comment.

    Actually I am trying to extract custom headers using Custom access logging. How to achieve this?

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠