Michal
Michal

Reputation: 175

AWS Gateway and CloudWatch logs

I seem to have an issue with seeing logs in AWS CloudWatch for my AWS Gateway.

I did the following:

Now I can see a Log Group that seem to correspond to my AWS Gateway and Log Streams but all of them are empty.

I think I'm missing something here.

Thanks, Michal

Upvotes: 4

Views: 1174

Answers (1)

Abdullah Khawer
Abdullah Khawer

Reputation: 5688

Set up API Logging Using the API Gateway Console

To set up API logging, you must have deployed the API to a stage. You must also have configured an appropriate CloudWatch Logs role ARN for your account.

  1. Sign in to the API Gateway console at here.
  2. Choose Settings from the primary navigation panel and type an ARN of an IAM role with appropriate permissions in CloudWatch log role ARN. You need to do this once.
  3. Do one of the following:
    • Choose an existing API and then choose a stage.
    • Create an API and deploy it to a stage.
  4. Choose Logs/Tracing in the Stage Editor.
  5. To enable execution logging:
    1. Choose Enable CloudWatch Logs under CloudWatch Settings.
    2. Choose Error or Info from the dropdown menu.
    3. If desired, choose Enable Detailed CloudWatch Metrics.

For more information about CloudWatch metrics, see Monitor API Execution with Amazon CloudWatch.

  1. To enable access logging:
    1. Choose to Enable Access Logging under Custom Access Logging.
    2. Type the ARN of a log group in CloudWatch Group. The ARN format is arn:aws:logs:{region}:{account-id}:log-group:API-Gateway-Execution-Logs_{rest-api-id}/{stage-name}.
    3. Type a log format in Log Format. You can choose CLF, JSON, XML, or CSV to use one of the provided examples as a guide.
  2. Choose Save Changes.

Note: You can enable execution logging and access logging independent of each other.

Reference: Set Up CloudWatch API Logging in API Gateway

Upvotes: 4

Related Questions