API Gateway and Lambda Logs

From @jayair on Fri Oct 06 2017 22:39:05 GMT+0000 (UTC)

Link to chapter - https://serverless-stack.com/chapters/api-gateway-and-lambda-logs.html

Copied from original issue: https://github.com/AnomalyInnovations/serverless-stack-com/issues/146

I can see the lambda logs in (as an example) /aws/lambda/notes-app-prod-list but in my transcations log: API-Gateway-Execution-Logs_m9t5cs42s4/prod I always gets an “No events found” when I opens the first stream.

Any ideas to what I might be missing?

Kind regards.

I’ve tried to redeploy the API after setting the cloudwatch, but with the same result.

The logs are starting to come in now. It might just have been some deplays.

Yeah there is a bit of a delay with the logs.

I managed to enable logs as suggested in this post API Gateway and Lambda Logs by adding 2 lines to serverless.yml:

provider:
  ...
  logs:
    restApi: true

Seems a lot easier than in the chapter, what are the downsides of this approach?

I haven’t looked into how they handle it internally. But this chapter was written back when this option wasn’t available. We’ll leave it up there in case somebody wants to know how to do it through the AWS Console.