简体   繁体   中英

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:

  • created IAM role that allows for CloudWatch logs
  • created API and set IAM ARN in the API settings
  • Enabled CloudWatch Logs in the stage settings

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

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 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM