@@ -38,9 +38,8 @@ import (
3838var orphanedCmd = & cobra.Command {
3939 Use : "orphaned" ,
4040 Short : "Find orphaned resources without deleting" ,
41- Long : `Finds all of the specified resources that are not referenced from an active CloudFormation stack.
42- Supported types are AWS::DynamoDB::Table, AWS::KMS::Key, AWS::Kinesis::Stream, AWS::Logs::LogGroup, AWS::S3::Bucket` ,
43- Run : orphaned ,
41+ Long : `Finds all of the specified resources that are not referenced from an active CloudFormation stack.` ,
42+ Run : orphaned ,
4443}
4544
4645func orphaned (cmd * cobra.Command , args []string ) {
@@ -136,7 +135,7 @@ func getSession() *session.Session {
136135func processLogs (rootedResources map [string ]bool ) {
137136 svc := cloudwatchlogs .New (getSession ())
138137
139- fmt .Printf ("GroupName, RetentionDays, StoredBytes , LastLogEntry, DaysAgo\n " )
138+ fmt .Printf ("GroupName, RetentionDays, StoredBytesRaw, StoredBytesHuman , LastLogEntry, DaysAgo\n " )
140139 var nextGroup * string
141140 for ok := true ; ok ; ok = (nextGroup != nil ) {
142141 groups , err := svc .DescribeLogGroups (& cloudwatchlogs.DescribeLogGroupsInput {
@@ -198,8 +197,9 @@ func processLogs(rootedResources map[string]bool) {
198197 fmt .Printf ("\t retention %d\n " , retentionDays )
199198 fmt .Printf ("\t bytes %v\n " , * group .StoredBytes )
200199 }
201- size := humanize .Bytes (uint64 (* group .StoredBytes ))
202- fmt .Printf ("\" %v\" , %d, %v, %v, %d\n " , * group .LogGroupName , retentionDays , size , lastEvent , daysAgo )
200+ sizeHuman := humanize .Bytes (uint64 (* group .StoredBytes ))
201+ sizeRaw := uint64 (* group .StoredBytes )
202+ fmt .Printf ("\" %v\" , %d, %v, %v, %v, %d\n " , * group .LogGroupName , retentionDays , sizeRaw , sizeHuman , lastEvent , daysAgo )
203203 }
204204 }
205205 }
@@ -358,6 +358,9 @@ func init() {
358358
359359 // Cobra supports local flags which will only run when this command
360360 // is called directly, e.g.:
361- orphanedCmd .Flags ().StringVarP (& Resource , "resource" , "r" , "AWS::DynamoDB::Table" , "Which type of resource to enumerate" )
361+ orphanedCmd .Flags ().StringVarP (& Resource , "resource" , "r" , "" ,
362+ `Which type of resource to enumerate
363+ Supported types are AWS::DynamoDB::Table, AWS::KMS::Key, AWS::Kinesis::Stream,
364+ AWS::Logs::LogGroup, AWS::S3::Bucket` )
362365
363366}
0 commit comments