4
4
"context"
5
5
"fmt"
6
6
"log"
7
+ "os"
7
8
"slices"
8
9
"strings"
9
10
"time"
@@ -47,7 +48,10 @@ func execute(c *cli.Context) error { //nolint:funlen,gocyclo
47
48
entry : logrus .WithField ("source" , "standard-logger" ),
48
49
})
49
50
50
- logrus .Tracef ("tenant id: %s" , c .String ("tenant-id" ))
51
+ logger := logrus .StandardLogger ()
52
+ logger .SetOutput (os .Stdout )
53
+
54
+ logger .Tracef ("tenant id: %s" , c .String ("tenant-id" ))
51
55
52
56
authorizers , err := azure .ConfigureAuth (ctx ,
53
57
c .String ("environment" ), c .String ("tenant-id" ), c .String ("client-id" ),
@@ -57,7 +61,7 @@ func execute(c *cli.Context) error { //nolint:funlen,gocyclo
57
61
return err
58
62
}
59
63
60
- logrus .Trace ("preparing to run nuke" )
64
+ logger .Trace ("preparing to run nuke" )
61
65
62
66
params := & libnuke.Parameters {
63
67
Force : c .Bool ("force" ),
@@ -113,7 +117,7 @@ func execute(c *cli.Context) error { //nolint:funlen,gocyclo
113
117
n := libnuke .New (params , filters , parsedConfig .Settings )
114
118
115
119
n .SetRunSleep (5 * time .Second )
116
- n .SetLogger (logrus .WithField ("component" , "nuke" ))
120
+ n .SetLogger (logger .WithField ("component" , "nuke" ))
117
121
118
122
n .RegisterVersion (fmt .Sprintf ("> %s" , common .AppVersion .String ()))
119
123
@@ -178,9 +182,17 @@ func execute(c *cli.Context) error { //nolint:funlen,gocyclo
178
182
return err
179
183
}
180
184
181
- logrus .Debug ("registering scanner for tenant subscription resources" )
185
+ logger .
186
+ WithField ("component" , "run" ).
187
+ WithField ("scope" , "tenant" ).
188
+ Debug ("registering scanner" )
182
189
for _ , subscriptionID := range tenant .SubscriptionIds {
183
- logrus .Debug ("registering scanner for subscription resources" )
190
+ logger .
191
+ WithField ("component" , "run" ).
192
+ WithField ("scope" , "subscription" ).
193
+ WithField ("subscription_id" , subscriptionID ).
194
+ Debug ("registering scanner" )
195
+
184
196
parts := strings .Split (subscriptionID , "-" )
185
197
if err := n .RegisterScanner (azure .SubscriptionScope ,
186
198
libscanner .New (fmt .Sprintf ("sub/%s" , parts [:1 ][0 ]), subResourceTypes , & azure.ListerOpts {
@@ -196,9 +208,15 @@ func execute(c *cli.Context) error { //nolint:funlen,gocyclo
196
208
197
209
for subscriptionID , resourceGroups := range tenant .ResourceGroups {
198
210
for _ , rg := range resourceGroups {
199
- logrus .Debug ("registering scanner for resource group" )
211
+ logger .
212
+ WithField ("component" , "run" ).
213
+ WithField ("scope" , "resource-group" ).
214
+ WithField ("subscription_id" , subscriptionID ).
215
+ WithField ("resource_group" , rg ).
216
+ Debug ("registering scanner" )
217
+
200
218
if err := n .RegisterScanner (azure .ResourceGroupScope ,
201
- libscanner .New (fmt .Sprintf ("rg/%s" , rg ), rgResourceTypes , & azure.ListerOpts {
219
+ libscanner .New (fmt .Sprintf ("sub/%s/ rg/%s" , subscriptionID , rg ), rgResourceTypes , & azure.ListerOpts {
202
220
Authorizers : tenant .Authorizers ,
203
221
TenantID : tenant .ID ,
204
222
SubscriptionID : subscriptionID ,
0 commit comments