Skip to content

fix: stop truncating logs to 10 at a time when running svc logs --follow#3258

Merged
mergify[bot] merged 3 commits intoaws:mainlinefrom
efekarakus:repro/logs-issue-3220
Feb 9, 2022
Merged

fix: stop truncating logs to 10 at a time when running svc logs --follow#3258
mergify[bot] merged 3 commits intoaws:mainlinefrom
efekarakus:repro/logs-issue-3220

Conversation

@efekarakus
Copy link
Copy Markdown
Contributor

Fixes #3220

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the Apache 2.0 License.

@efekarakus efekarakus requested a review from a team as a code owner February 9, 2022 00:11
@efekarakus efekarakus requested review from Lou1415926 and removed request for a team February 9, 2022 00:11
Comment thread internal/pkg/logging/service.go Outdated
}
if o.Follow {
// Start following log events from current timestamp.
return aws.Int64(now().Unix() * 1000) // Multiplied by 1000 to convert the Unix() timestamp in seconds to milliseconds
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: or alternatively...

Suggested change
return aws.Int64(now().Unix() * 1000) // Multiplied by 1000 to convert the Unix() timestamp in seconds to milliseconds
return aws.Int64(now().UnixMilli())

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow I had no idea this method existed 😂 fixed!

I also changed it in other places in the codebase where we multiplied by 1000

mockDefaultLimit := aws.Int64(10)
var mockNilLimit *int64
mockStartTime := aws.Int64(123456789)
mockCurrentTimestamp := time.Date(2020, 11, 23, 0, 0, 0, 0, time.UTC) // Copilot GA date :).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😻

@mergify mergify Bot merged commit 878acac into aws:mainline Feb 9, 2022
@efekarakus efekarakus deleted the repro/logs-issue-3220 branch February 9, 2022 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

svc logs --follow doesn't print all logs

5 participants