Remediation
From Google Cloud Consoleβ
Create the prescribed log metricβ
-
Go to
Logging/Logs-based Metrics
by visiting https://console.cloud.google.com/logs/metrics and click "CREATE METRIC". -
Click the down arrow symbol on the
Filter Bar
at the rightmost corner and selectConvert to Advanced Filter
. -
Clear any text and add:
resource.type="iam_role"
AND (protoPayload.methodName = "google.iam.admin.v1.CreateRole"
OR protoPayload.methodName="google.iam.admin.v1.DeleteRole"
OR protoPayload.methodName="google.iam.admin.v1.UpdateRole") -
Click
Submit Filter
. Display logs appear based on the filter text entered by the user. -
In the
Metric Editor
menu on the right, fill out the name field. SetUnits
to1
(default) andType
toCounter
. This ensures that the log metric counts the number of log entries matching the advanced logs query. -
Click
Create Metric
.