Skip to content

Unable to enable cloud watch logs #22

@jonathandeclan

Description

@jonathandeclan

When trying to enable cloud watch logs for API Gateway using the configuration in serverless.yml, resulting deployment does not have it enabled even though configuration and cloud formation template contains it

Test code:

Serverless:

service:
  name: api-gateway-test

provider:
  name: aws
  profile: dev
  runtime: nodejs10.x

  stage: dev
  region: ap-southeast-1

functions:
  hello:
    handler: index.hello
    events:
      - http:
          path: /hello
          method: GET
  
resources:
  Resources:
    ApiGatewayStage:
      Type: AWS::ApiGateway::Stage        
      Properties:
        RestApiId:
          Ref: ApiGatewayRestApi
        MethodSettings:
          - DataTraceEnabled: true
            HttpMethod: '*'
            LoggingLevel: INFO
            ResourcePath: '/*'
            MetricsEnabled: true

plugins:
  - serverless-plugin-stage-variables

Using SLS_DEBUG=* , this is output during deployment:

Serverless: Invoke aws:info
Serverless: [AWS cloudformation 200 0.075s 0 retries] describeStacks({ StackName: 'api-gateway-test-dev' })
Serverless: [AWS cloudformation 200 0.085s 0 retries] listStackResources({ StackName: 'api-gateway-test-dev' })
Service Information
service: api-gateway-test
stage: dev
region: ap-southeast-1
stack: api-gateway-test-dev
resources: 11
api keys:
  None
endpoints:
  GET - https://1n58uu462m.execute-api.ap-southeast-1.amazonaws.com/dev/hello
functions:
  hello: api-gateway-test-dev-hello
layers:
  None
Serverless: [AWS sts 200 1.253s 0 retries] getCallerIdentity({})
Serverless: [AWS apigateway 200 0.294s 0 retries] getRestApis({ position: undefined, limit: 500 })
Serverless: [AWS apigateway 200 0.074s 0 retries] getStage({ restApiId: '1n58uu462m', stageName: 'dev' })
Serverless: [AWS apigateway 200 0.319s 0 retries] updateStage({ restApiId: '1n58uu462m',
  stageName: 'dev',
  patchOperations:
   [ { op: 'replace', path: '/tracingEnabled', value: 'false' },
     { op: 'replace', path: '/*/*/logging/dataTrace', value: 'false' },
     { op: 'replace', path: '/*/*/logging/loglevel', value: 'OFF' },
     [length]: 3 ] })
Serverless: [AWS apigateway 204 0.087s 0 retries] untagResource({ resourceArn:
   'arn:aws:apigateway:ap-southeast-1::/restapis/1n58uu462m/stages/dev',
  tagKeys: [ 'STAGE', [length]: 1 ] })
Serverless: [AWS cloudwatchlogs 400 0.055s 0 retries] deleteLogGroup({ logGroupName: '/aws/api-gateway/api-gateway-test-dev' })
Serverless: Invoke aws:deploy:finalize
Serverless: [AWS s3 200 0.063s 0 retries] listObjectsV2({ Bucket:
   'api-gateway-test-dev-serverlessdeploymentbucket-11ha0q8axdnya',
  Prefix: 'serverless/api-gateway-test/dev' })
Serverless Enterprise: Run `serverless login` and deploy again to explore, monitor, secure your serverless project for free.

Noticed there are patch operations which show values for datatrace as false.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions