4
votes

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

1
is this vpc gateway or api gateway? (vpc flow logs | enable api traces in api logging )v_sukt
@Michal, If you liked the answer and it worked for you, kindly approve it and upvote it as well as recommended by Stack Overflow. Thanks.abdullahkhawer

1 Answers

4
votes

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