Skip to content

Commit

Permalink
fix - aws rds download logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicola Strappazzon C committed Oct 28, 2023
1 parent 04bffd1 commit 1bb05cd
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions aws/rds/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,22 @@ func (r *RDS) PollLogs(identifier, filename string) (string, error) {
params := &rds.DownloadDBLogFilePortionInput{
DBInstanceIdentifier: aws.String(identifier),
LogFileName: aws.String(filename),
Marker: aws.String("0"),
}

result, err := r.Client.DownloadDBLogFilePortion(params)
var body string

err := r.Client.DownloadDBLogFilePortionPages(
params,
func(page *rds.DownloadDBLogFilePortionOutput, lastPage bool) bool {
body = body + aws.StringValue(page.LogFileData)
return !lastPage
})
if err != nil {
return "", err
}

if result.LogFileData != nil {
return aws.StringValue(result.LogFileData), nil
}

return "", nil
return body, nil
}

func (r *RDS) ParametersGroup() (ParametersGroup, error) {
Expand Down

0 comments on commit 1bb05cd

Please sign in to comment.