Skip to main content

🧠 Google Logging Log Metric Filter and Alerts for VPC Network 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:15.109884823Z 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/vpc-network-changes-monitoring/policy.yaml9F4DA77AFABAF3096EA77A03AD668893
Open/ce/ca/google/logging/vpc-network-changes-monitoring/prod.logic.yamlD74C388B2B4D9CE0C0F8E64DCCA83011
Open/types/CA10__CaGoogleLoggingLogMetric__c/object.extracts.yamlD10B1CB14CDBBB08D9E3B38F2BB16DD2
Open/types/CA10__CaGoogleMonitoringAlertPolicy__c/object.extracts.yamlFB18542F30919AFFF9B8EC854708DAC7
Open/ce/ca/google/logging/vpc-network-changes-monitoring/test-data.json627B13038D4D523BB98427FEA394B035
Open/types/CA10__CaGoogleProject__c/object.extracts.yaml8EB422663BF4493D44ABA5FEC0FB9AD4

Generate FULL script​

java -jar repo-manager.jar policies generate FULL /ce/ca/google/logging/vpc-network-changes-monitoring/prod.logic.yaml

Generate DEBUG script​

java -jar repo-manager.jar policies generate DEBUG /ce/ca/google/logging/vpc-network-changes-monitoring/prod.logic.yaml

Generate CAPTURE_TEST_DATA script​

java -jar repo-manager.jar policies generate CAPTURE_TEST_DATA /ce/ca/google/logging/vpc-network-changes-monitoring/prod.logic.yaml

Generate TESTS script​

java -jar repo-manager.jar policies generate TESTS /ce/ca/google/logging/vpc-network-changes-monitoring/prod.logic.yaml

Execute tests​

java -jar repo-manager.jar policies test /ce/ca/google/logging/vpc-network-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: 'resource.type="gce_network" AND protoPayload.methodName="beta.compute.networks.insert" OR protoPayload.methodName="beta.compute.networks.patch" OR protoPayload.methodName="v1.compute.networks.delete" OR protoPayload.methodName="v1.compute.networks.removePeering" OR protoPayload.methodName="v1.compute.networks.addPeering"'
- 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."