The logs endpoint shows any debug logs produced by executed Functions. To have logs show up on this endpoint, add
_10
console.log("This is an info level log message from my function")
_10
_10
console.warn("This is a warning log message from my function")
_10
_10
console.error("This is an error log message from my function")
to your Function code and invoke it. The log line will show up at the /Logs sub-resource of an Environment. Only Environments with a deployed build will generate logs.
Serverless toolkit usage
The Serverless Toolkit has debug log tail ability built in to aid in debugging from the command line. To tail logs for deployed functions, execute the following command from within a deployed Serverless project:
_10
twilio serverless:logs --tail
Debugger and webhooks
Log lines written at WARN or ERROR level will also show up in the Twilio Debugger. Debugger will store WARN and ERROR logs for up to 30 days. You can set up a webhook to trigger on all (not just Functions) errors and warnings here.
Stream live logs in the browser
For Functions created via the API, you can show live logs for debugging by loading the Services page in the Twilio Console, opening the Service to track, and clicking the Show Logs toggle in the bottom-right corner of the UI.
(information)
Info
The Show Logs toggle will only be visible if you have a live build associated with your environment via a Deployment.
Limits and constraints
Logs are available for the last 30 days only.
Logs are limited to the last 3KB of output per invocation. If you log over this limit, the output will be truncated.
Only 10,000 results are returned for a given query. Use the
StartDate
and
EndDate
filters to limit your query.
The
/Logs
endpoint is rate limited to 5 requests per second.
Timestamps for logs are to millisecond precision, which means that logs produced within the same millisecond could appear out of order.
Supported filters
Use these parameters on the /Logs request to retrieve specific logs.