Search⌘ K
AI Features

Logging Incoming Events

Explore how to use the sam logs command with the --tail option to continuously monitor log outputs for AWS Lambda functions. Understand how to add event logging in your function code to inspect incoming event data, aiding in effective debugging and troubleshooting during development.

We'll cover the following...

An amazingly useful option of sam logs is --tail. It will continuously check for updates and show new log outputs as they appear. Remember that CloudWatch isn’t pulling information from a single source, so the tail operation isn’t synchronous, but it is generally quick enough for troubleshooting.

Run the sam logs command in tail mode and keep it open. Then, you’ll add some more logging to the function so you can see the outputs.

sam logs -n
...