Summary
Add a nextdeploy logs command that streams CloudWatch logs from the deployed Lambda function in real-time.
Expected Behavior
# Tail logs in real-time
nextdeploy logs --tail
# Show last 100 log lines
nextdeploy logs --lines 100
# Show logs from last 30 minutes
nextdeploy logs --since 30m
Implementation Notes
- Use AWS CloudWatch Logs SDK (
FilterLogEvents or GetLogEvents)
- Lambda log group follows pattern:
/aws/lambda/<function-name>
- Function name is available from
nextdeploy.yml config
- Use polling with
FilterLogEvents + nextToken for tail mode
Files to Create/Modify
cli/cmd/logs.go — [NEW] Cobra command definition
cli/internal/serverless/aws_logs.go — [NEW] CloudWatch Logs implementation
cli/cmd/root.go — Register the new command
Reference
- Look at
cli/cmd/ship.go for how AWS credentials are initialized
- The
AWSProvider struct in cli/internal/serverless/aws.go already has an AWS config
Difficulty: Medium · Language: Go
Summary
Add a
nextdeploy logscommand that streams CloudWatch logs from the deployed Lambda function in real-time.Expected Behavior
Implementation Notes
FilterLogEventsorGetLogEvents)/aws/lambda/<function-name>nextdeploy.ymlconfigFilterLogEvents+nextTokenfor tail modeFiles to Create/Modify
cli/cmd/logs.go— [NEW] Cobra command definitioncli/internal/serverless/aws_logs.go— [NEW] CloudWatch Logs implementationcli/cmd/root.go— Register the new commandReference
cli/cmd/ship.gofor how AWS credentials are initializedAWSProviderstruct incli/internal/serverless/aws.goalready has an AWS configDifficulty: Medium · Language: Go