aws logs tail: Usage, Follow & Common CI Errors
Stream CloudWatch Logs in real time - like tail -f for the cloud.
aws logs tail streams events from a CloudWatch Logs group to your terminal, optionally following new events live. It is the fastest way to watch a Lambda or service while debugging in CI.
What it does
aws logs tail <group-name> prints recent log events and, with --follow, keeps streaming new ones. --since accepts relative times (5m, 1h) or timestamps, --filter-pattern narrows to matching events, and --format short keeps lines compact. The group name is the full path, e.g. /aws/lambda/my-fn.
Common usage
# Tail the last 10 minutes and follow live
aws logs tail /aws/lambda/my-fn --since 10m --follow
# Filter for errors, compact format
aws logs tail /aws/lambda/my-fn --since 1h \
--filter-pattern "ERROR" --format shortCommon error in CI: ResourceNotFoundException / tail hangs forever
tail fails with "An error occurred (ResourceNotFoundException) ... The specified log group does not exist" when the group name is wrong or the function has not logged yet (the group is created on first invocation), and in CI --follow blocks the job indefinitely. Fix: pass the full group path (/aws/lambda/<name>) and confirm it exists with aws logs describe-log-groups; never use --follow in a non-interactive pipeline - use a bounded --since window instead so the command exits. Reads need logs:GetLogEvents / FilterLogEvents on the group.
Key options
| Option | Purpose |
|---|---|
| <group-name> | Full log group path |
| --follow | Stream new events (avoid in CI) |
| --since | Relative/absolute start (5m, 1h, ISO) |
| --filter-pattern | Only matching events |
| --format short | Compact output |