3

Hi I'm trying to enable Cloudwatch logs in API Gateway using Cloudformation. However, I do not find the the documentation to do so. All I can find is Logginglevel in the official documentation which doesn't seem to be the solution.

For context I'm looking to achieve this using Cloudformation but don't know how to. Please help.

Done Manually here from console

2 Answers 2

2

These log settings are set using MethodSetting:

  • DataTraceEnabled - is for "Log full requests..."
  • LoggingLevel is for "Log level"
  • MetricsEnabled is for "Enable detailed CloudWatch metrics"
Sign up to request clarification or add additional context in comments.

4 Comments

I tried this and get this error StageDescription cannot be specified when stage referenced by StageName already exists Any Idea why?
@RedBottle Can you update your question with relevant template parts?
Nvm this is a seperate issue. My initial question is answered. Thank you.
This is for v1. Is there anything for ApiGatewayV2? I've created a similar question stackoverflow.com/q/67670073/2948212
0

Yaml template snippet for ApiGateway V1:

SomeApiStage: Type: AWS::ApiGateway::Stage Properties: RestApiId: Ref: SomeApi DeploymentId: Ref: SomeApiDeployment StageName: some-api Description: Some Api stage MethodSettings: - ResourcePath: "/*" HttpMethod: "*" MetricsEnabled: true DataTraceEnabled: true LoggingLevel: "INFO" 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.