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

Red Bottle
  • 2,839
  • 4
  • 22
  • 59

2 Answers2

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"
Marcin
  • 215,873
  • 14
  • 235
  • 294
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"
kairius
  • 395
  • 6
  • 10