Skip to content

Commit

Permalink
minor bytes to mb
Browse files Browse the repository at this point in the history
  • Loading branch information
omerh committed May 2, 2024
1 parent 0db8894 commit 27371f2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/helpers/cloudwatch_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ func GetCloudwatchGroups(region string) []*cloudwatchlogs.LogGroup {
return cloudwatchGroups
}

func bytesToMB(bytes uint64) float64 {
const bytesInMB = 1024 * 1024
return float64(bytes) / float64(bytesInMB)
}

// SetCloudwatchGroupsExpiry Set expiry on a cloudwatch group
func SetCloudwatchGroupsExpiry(region string, retention int64, cloudwatchGroups []*cloudwatchlogs.LogGroup, apply bool, override bool) {
awsSession, _ := InitAwsSession(region)
Expand Down Expand Up @@ -75,7 +80,9 @@ func SetCloudwatchGroupsExpiry(region string, retention int64, cloudwatchGroups
}
if noRetentionSet {
log.Printf("Region %s total log size:", region)
log.Printf("Total log size in with no retention policy is: %v bytes", totalLogByteSize)
totalLogByteSizeInMB := bytesToMB(uint64(totalLogByteSize))
// log.Println(totalLogByteSize)
log.Printf("Total log size in with no retention policy is: %.2f MB", totalLogByteSizeInMB)
}

fmt.Println("=====================================================================================================")
Expand Down

0 comments on commit 27371f2

Please sign in to comment.