Skip to content

Commit

Permalink
Fix apps logs
Browse files Browse the repository at this point in the history
  • Loading branch information
nightfury1204 committed Jul 2, 2024
1 parent fff94d8 commit 6c77500
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pkg/helpers/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,10 @@ func CloudWatchLogsStream(ctx context.Context, cw cloudwatchlogsiface.CloudWatch
var start int64

if opts.Since != nil {
start = time.Now().UTC().Add((*opts.Since)*-1).Unix() * int64(time.Microsecond)
start = time.Now().UTC().Add((*opts.Since) * -1).UnixMilli()
req.StartTime = aws.Int64(start)
} else {
req.StartTime = aws.Int64(time.Now().UTC().Add(-1 * time.Hour).UnixMilli())
}

if stream != "" {
Expand All @@ -390,13 +392,21 @@ func CloudWatchLogsStream(ctx context.Context, cw cloudwatchlogsiface.CloudWatch
if err != nil {
switch AwsErrorCode(err) {
case "ThrottlingException", "ResourceNotFoundException":
time.Sleep(1 * time.Second)
time.Sleep(3 * time.Second)
continue
default:
return err
}
}

if res != nil {
if res.NextToken != nil {
time.Sleep(2 * time.Second)
} else if len(res.Events) == 0 {
time.Sleep(5 * time.Second)
}
}

es := []*cloudwatchlogs.FilteredLogEvent{}

for _, e := range res.Events {
Expand Down

0 comments on commit 6c77500

Please sign in to comment.