-
-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Description
I just spent a few minutes wondering why I wasn't seeing any log output. 😂
I was using saw get /aws/lambda/<group_name> but forgot to add --start -10m to the end of the command.
The default is time.Now() so I wasn't seeing any logs.
Lines 84 to 92 in 77bbab2
| currentTime := time.Now() | |
| absoluteStartTime := currentTime | |
| if c.Start != "" { | |
| st, err := getTime(c.Start, currentTime) | |
| if err == nil { | |
| absoluteStartTime = st | |
| } | |
| } | |
| input.SetStartTime(aws.TimeUnixMilli(absoluteStartTime)) |
AWS SAM [1] and Serverless Framework [2] both use -10m as their default for log retrieval, whereas saw uses the current time.
- [1] - https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-logs.html
- [2] - https://www.serverless.com/framework/docs/providers/aws/cli-reference/logs/
Seems like a straightforward change to set the empty string "" to -10m to match.
Lines 42 to 51 in 77bbab2
| func init() { | |
| getCommand.Flags().StringVar(&getConfig.Prefix, "prefix", "", "log group prefix filter") | |
| getCommand.Flags().StringVar( | |
| &getConfig.Start, | |
| "start", | |
| "", | |
| `start getting the logs from this point | |
| Takes an absolute timestamp in RFC3339 format, or a relative time (eg. -2h). | |
| Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".`, | |
| ) |
What do you think? I've applied it in my fork, and am using it. Happy to PR.
Kalsofar and goetzc
Metadata
Metadata
Assignees
Labels
No labels