Red Bottle
Red Bottle

Reputation: 3080

How to enable Cloudwatch Logs for API Gateway using Cloudformation?

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

Upvotes: 3

Views: 1827

Answers (2)

kairius
kairius

Reputation: 540

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"

Upvotes: 0

Marcin
Marcin

Reputation: 238189

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"

Upvotes: 2

Related Questions