@@ -13,7 +13,7 @@ import (
13
13
"google.golang.org/genproto/googleapis/cloud/audit"
14
14
)
15
15
16
- func Tail (ctx context.Context , projectID string , cb func (* audit.AuditLog ) error ) error {
16
+ func Tail (ctx context.Context , projectID , clusterName string , cb func (* audit.AuditLog ) error ) error {
17
17
client , err := logging .NewClient (ctx )
18
18
if err != nil {
19
19
return fmt .Errorf ("failed to create client: %w" , err )
@@ -34,7 +34,7 @@ func Tail(ctx context.Context, projectID string, cb func(*audit.AuditLog) error)
34
34
[]string {
35
35
`resource.type="k8s_cluster"` ,
36
36
fmt .Sprintf (`log_name="projects/%s/logs/cloudaudit.googleapis.com%%2Factivity"` , projectID ),
37
- `resource.labels.cluster_name="platform"` ,
37
+ fmt . Sprintf ( `resource.labels.cluster_name="%s"` , clusterName ) ,
38
38
`protoPayload."@type"="type.googleapis.com/google.cloud.audit.AuditLog"` ,
39
39
`protoPayload.methodName=~"io\.fluxcd\.toolkit\..*\.patch"` ,
40
40
`-protoPayload.authenticationInfo.principalEmail=~"system:.*"` ,
@@ -43,7 +43,7 @@ func Tail(ctx context.Context, projectID string, cb func(*audit.AuditLog) error)
43
43
),
44
44
}
45
45
if err = stream .Send (req ); err != nil {
46
- return fmt .Errorf ("stream.Send error : %w" , err )
46
+ return fmt .Errorf ("stream send failed : %w" , err )
47
47
}
48
48
49
49
return read (ctx , stream , cb )
0 commit comments