From time to time, for development purposes, developers might need to access runtime logs for one or more AWS Lambdaexternal link functions that Webiny deploys. This guide shows how to access these logs.

CloudWatch Logs
anchor

The first way of accessing logs is by using CloudWatch Logsexternal link:

  1. Open CloudWatch Management Consoleexternal link.
  2. Click on Log groups in the left-hand menu.
  3. Click on the log group that corresponds to the function you want to view logs for (logs are grouped by function name). You can also use the search bar to quickly find the log group you’re looking for. For example, you can type graphql to find the log group that contains logs for Webiny’s GraphQL API.
  4. Select a log stream. Note that, usually, there is more than one log stream for a function, so you will need to select the one that corresponds to the time period you’re interested in.
  5. You should now see the logs for the Lambda function you selected.
CloudWatch LogsCloudWatch Logs
(click to enlarge)

Examples
anchor

GraphQL API
anchor

If you need to access the logs for Webiny’s GraphQL API, the log group you’re looking for is called /aws/lambda/{prefix}-graphql-{suffix}, for example:

Type graphql in the search bar to quickly find the log group.

Data Migrations
anchor

If you need to access data migrations-related logs, the log group you’re looking for is called /aws/lambda/{prefix}-data-migration-{suffix}, for example:

Type data-migration in the search bar to quickly find the log group.

CloudWatch Logs Insights
anchor

CloudWatch Logs Insightsexternal link enables you to interactively search and analyze your logs. Most importantly, the service allows you to search logs not only across multiple log streams, but also across multiple log groups. This is especially useful when you need to search logs for multiple functions at once.

CloudWatch Logs Insights can be accessed from the CloudWatch Management Consoleexternal link. To access it, click on Logs Insights in the left-hand menu. You will be presented with a query editor via which you can then perform queries.

CloudWatch Logs InsightsCloudWatch Logs Insights
(click to enlarge)

Examples
anchor

GraphQL API Error Logs
anchor

To access GraphQL API error logs, first, select the graphql AWS Lambda function’s log group. You can do that by typing graphql in the search bar. Once you’ve selected the log group, select the time period you’re interested in and use the following query:

GraphQL API Error LogsGraphQL API Error Logs
(click to enlarge)

GraphQL API and Data Migrations Logs
anchor

To access all logs for GraphQL API and data migrations at the same time, first, select the graphql and data-migration AWS Lambda functions’ log groups. You can do that by typing graphql and data-migration in the search bar. Once you’ve selected the log groups, select the time period you’re interested in and use the following query:

GraphQL API and Data Migrations LogsGraphQL API and Data Migrations Logs
(click to enlarge)