Logging Incoming Events

In this lesson, you'll learn how to keep a continuous​ check on logs using the `--tail` option of the `sam logs` command.

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 HelloWorldFunction --stack-name sam-test-1 --tail

Get hands-on with 1200+ tech skills courses.