π§ Google Logging Log Metric Filter and Alerts for Custom Role Changes do not exist - prod.logic.yaml π’
- Contextual name: π§ prod.logic.yaml π’
- ID:
/ce/ca/google/logging/custom-role-changes-monitoring/prod.logic.yaml
- Located in: π Google Logging Log Metric Filter and Alerts for Custom Role Changes do not exist π’
Flagsβ
- π’ Logic test success
- π’ Logic with extracts
- π’ Logic with test data
Input Typeβ
Type | API Name | Extracts | Extract Files | Logic Files | |
---|---|---|---|---|---|
π | π Google Project | CA10__CaGoogleProject__c | 2 | 1 | 16 |
Usesβ
- π Google Logging Log Metric - object.extracts.yaml
- π Google Monitoring Alert Policy - object.extracts.yaml
- π Google Project - object.extracts.yaml
- π§ͺ test-data.json
Test Results π’β
Generated at: 2025-04-24T23:47:09.422309725Z Open
Result | Id | Condition Index | Condition Text | Runtime Error |
---|---|---|---|---|
π’ | aB9P1 | βοΈ 199 | βοΈ CA10__Google_Logging_Log_Metrics__r.has(COMPLIANT) | βοΈ null |
π’ | aB9P12 | βοΈ 200 | βοΈ otherwise | βοΈ null |
π’ | aB9P13 | βοΈ 200 | βοΈ otherwise | βοΈ null |
π’ | aB222 | βοΈ 200 | βοΈ otherwise | βοΈ null |
Generationβ
File | MD5 | |
---|---|---|
Open | /ce/ca/google/logging/custom-role-changes-monitoring/policy.yaml | C8C2EDD0C6005DC29BDC7A37D5C6EA52 |
Open | /ce/ca/google/logging/custom-role-changes-monitoring/prod.logic.yaml | 433FA5AE42D4649218902BBFD92FA08C |
Open | /types/CA10__CaGoogleLoggingLogMetric__c/object.extracts.yaml | D10B1CB14CDBBB08D9E3B38F2BB16DD2 |
Open | /types/CA10__CaGoogleMonitoringAlertPolicy__c/object.extracts.yaml | FB18542F30919AFFF9B8EC854708DAC7 |
Open | /types/CA10__CaGoogleProject__c/object.extracts.yaml | 8EB422663BF4493D44ABA5FEC0FB9AD4 |
Open | /ce/ca/google/logging/custom-role-changes-monitoring/test-data.json | D804614D5AC93619F674B71E0795935F |
Generate FULL scriptβ
java -jar repo-manager.jar policies generate FULL /ce/ca/google/logging/custom-role-changes-monitoring/prod.logic.yaml
Generate DEBUG scriptβ
java -jar repo-manager.jar policies generate DEBUG /ce/ca/google/logging/custom-role-changes-monitoring/prod.logic.yaml
Generate CAPTURE_TEST_DATA scriptβ
java -jar repo-manager.jar policies generate CAPTURE_TEST_DATA /ce/ca/google/logging/custom-role-changes-monitoring/prod.logic.yaml
Generate TESTS scriptβ
java -jar repo-manager.jar policies generate TESTS /ce/ca/google/logging/custom-role-changes-monitoring/prod.logic.yaml
Execute testsβ
java -jar repo-manager.jar policies test /ce/ca/google/logging/custom-role-changes-monitoring/prod.logic.yaml
Contentβ
---
inputType: "CA10__CaGoogleProject__c"
testData:
- file: test-data.json
importExtracts:
- file: /types/CA10__CaGoogleProject__c/object.extracts.yaml
conditions:
- status: "COMPLIANT"
currentStateMessage: "Log metric filter and alerts exist for Project Ownership Assignments/Changes."
check:
RELATED_LIST_HAS:
relationshipName: "CA10__Google_Logging_Log_Metrics__r"
status: "COMPLIANT"
otherwise:
status: "INCOMPLIANT"
currentStateMessage: "No log metric filter or alerts exist for Project Ownership Assignments/Changes."
remediationMessage: "Create log metric and alert policy."
relatedLists:
- relationshipName: "CA10__Google_Logging_Log_Metrics__r"
importExtracts:
- file: /types/CA10__CaGoogleLoggingLogMetric__c/object.extracts.yaml
- file: /types/CA10__CaGoogleMonitoringAlertPolicy__c/object.extracts.yaml
conditions:
- status: "COMPLIANT"
currentStateMessage: "Corresponding log metric exists."
check:
AND:
args:
- GCP_LOGGING_QUERY_MATCH:
arg:
EXTRACT: CA10__filter__c
value: '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")'
- RELATED_LIST_HAS:
relationshipName: "CA10__Google_Monitoring_Conditions__r"
status: "COMPLIANT"
otherwise:
status: "INCOMPLIANT"
currentStateMessage: "There is no log metric with such filter."
remediationMessage: "Create log metric with the appropriate filter."
relatedLists:
- relationshipName: "CA10__Google_Monitoring_Conditions__r"
conditions:
- status: "COMPLIANT"
currentStateMessage: "Alert policy exist and enabled."
check:
IS_EQUAL:
left:
EXTRACT: CA10__alertPolicy__r.CA10__enabledState__c
right:
TEXT: 'on'
otherwise:
status: "INCOMPLIANT"
currentStateMessage: "No alert policy exist or policy not enabled."
remediationMessage: "Create or enable alert policy."