Serverless API Gateway Logging

To anyone who can help,

I am trying to get serverless aws API gateway logs to work but no joy, I have multiple endpoint and when i deploy the code the log groups in cloudwatch for each endpoint is created but not logs or log streams are created when i query the endpoints. Code below for one endpoint where the logging is defined.

I have noticed that under the stages in the was api gateway -> logs/tracing doesn’t have enable cloudwatch logs clicked. When i manually click on this, logging then works but to a generic cloudwatch log group.

provider:
name: aws
runtime: nodejs12.x
region: us-west-1
apiGateway:
restApiId:
“Fn::ImportValue”: SharedGW-restApiId
restApiRootResourceId:
“Fn::ImportValue”: SharedGW-rootResourceId
logs:
restApi:
accessLogging: true
format: ‘requestId: $context.requestId’
executionLogging: true
role: arn:aws:iam::1234567890:role/Test-Logs-Gateway
roleManagedExternally: true
level: INFO
fullExecutionData: true

1 Like