Getting Application Logs
When debugging applications, you can retrieve logs using the Logs API. Logs include output from your functions such asprint() statements, errors, and any other stdout/stderr output.
Get Logs via API
Filtering Logs
You can filter logs using query parameters to narrow down results: Filter by Request IDevents if you want to filter out system events:
- Trace
- Debug
- Info
- Warning
- Error
gate parameter to combine multiple filters with AND (default) or OR logic:
Pagination and Ordering
Get Most Recent Logs (Default) By default, logs are returned in descending order (newest first). Usetail to specify the number of logs:
head to get logs in ascending order (oldest first):
nextToken from the response to fetch the next page:
Query Parameters Reference
| Parameter | Type | Description |
|---|---|---|
requestId | String | Filter logs for specific request IDs |
function | String | Filter logs for specific function names |
functionExecutor | String | Filter logs for specific function executor containers |
functionRunId | String | Filter logs for specific function runs |
allocationId | String | Filter logs for specific allocations |
level | Integer | Filter logs for specific log levels |
events | Integer | Filter system and application events |
gate | and | or | Logic for combining multiple filters (default: and) |
head | Integer | Number of logs to return in ascending order (default: 100) |
tail | Integer | Number of logs to return in descending order (default: 100) |
nextToken | String | Pagination token from previous response |
gate parameter as connector.
For example, filtering DEBUG and INFO logs:
Common Issues
Function Timeout
If your function is timing out, consider:- Increase the timeout - Set a higher
timeoutvalue in your@functiondecorator - Report progress - Use
ctx.progress.update()to reset the timeout. See Streaming Progress Updates - Check the logs - Use the Logs API above to see what your function was doing before it timed out
Request Failed
To investigate a failed request:- Check request state - Get the full request state including failure reason:
- Review logs - Filter logs by the request ID to see what happened:
Out of Memory
If your function is running out of memory:- Check current allocation - Review the
memorysetting in your@functiondecorator - Increase memory - Set
memoryto a higher value (up to 32 GB). See Memory - Process in batches - Break large datasets into smaller chunks
Debugging Tips
- Add
print()statements in your code to log intermediate values - Use
ctx.request_idto correlate logs across function calls. See Request ID - Check that your function has sufficient CPU, memory, and disk resources
- Review retry settings if functions are failing intermittently. See Retries