Skip to main content

🧠 Google Logging Log Metric Filter and Alerts for Project Ownership Assignments Changes do not exist - prod.logic.yaml 🟒

Flags​

Input Type​

TypeAPI NameExtractsExtract FilesLogic Files
πŸ”’πŸ“• Google ProjectCA10__CaGoogleProject__c2116

Uses​

Test Results πŸŸ’β€‹

Generated at: 2025-04-24T23:47:11.467790598Z Open

ResultIdCondition IndexCondition TextRuntime 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​

FileMD5
Open/ce/ca/google/logging/project-ownership-assignments-and-changes-monitoring/policy.yamlB69F6A6041F260B5483C08A4E050A0D3
Open/ce/ca/google/logging/project-ownership-assignments-and-changes-monitoring/prod.logic.yamlC3591E3E8456386F078547AAEF4E3C6A
Open/types/CA10__CaGoogleLoggingLogMetric__c/object.extracts.yamlD10B1CB14CDBBB08D9E3B38F2BB16DD2
Open/types/CA10__CaGoogleMonitoringAlertPolicy__c/object.extracts.yamlFB18542F30919AFFF9B8EC854708DAC7
Open/ce/ca/google/logging/project-ownership-assignments-and-changes-monitoring/test-data.json660999902285CE0C39E5BC41DE156B70
Open/types/CA10__CaGoogleProject__c/object.extracts.yaml8EB422663BF4493D44ABA5FEC0FB9AD4

Generate FULL script​

java -jar repo-manager.jar policies generate FULL /ce/ca/google/logging/project-ownership-assignments-and-changes-monitoring/prod.logic.yaml

Generate DEBUG script​

java -jar repo-manager.jar policies generate DEBUG /ce/ca/google/logging/project-ownership-assignments-and-changes-monitoring/prod.logic.yaml

Generate CAPTURE_TEST_DATA script​

java -jar repo-manager.jar policies generate CAPTURE_TEST_DATA /ce/ca/google/logging/project-ownership-assignments-and-changes-monitoring/prod.logic.yaml

Generate TESTS script​

java -jar repo-manager.jar policies generate TESTS /ce/ca/google/logging/project-ownership-assignments-and-changes-monitoring/prod.logic.yaml

Execute tests​

java -jar repo-manager.jar policies test /ce/ca/google/logging/project-ownership-assignments-and-changes-monitoring/prod.logic.yaml

Content​

Open File

---

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: '(protoPayload.serviceName="cloudresourcemanager.googleapis.com") AND (ProjectOwnership OR projectOwnerInvitee) OR (protoPayload.serviceData.policyDelta.bindingDeltas.action="REMOVE" AND protoPayload.serviceData.policyDelta.bindingDeltas.role="roles/owner") OR (protoPayload.serviceData.policyDelta.bindingDeltas.action="ADD" AND protoPayload.serviceData.policyDelta.bindingDeltas.role="roles/owner")'
- 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."