[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-05-15。"],[],[],null,["# Detective controls\n\nThreat detection and monitoring capabilities are provided using a combination of\nbuilt-in security controls from Security Command Center and custom solutions that let you\ndetect and respond to security events.\n\nCentralized logging for security and audit\n------------------------------------------\n\nThe blueprint configures logging capabilities to track and analyze changes to\nyour Google Cloud resources with logs that are aggregated to a single project.\n\nThe following diagram shows how the blueprint aggregates logs from multiple\nsources in multiple projects into a centralized log sink.\n\nThe diagram describes the following:\n\n- Log sinks are configured at the organization node to aggregate logs from all projects in the resource hierarchy.\n- Multiple log sinks are configured to send logs that match a filter to different destinations for storage and analytics.\n- The `prj-c-logging` project contains all the resources for log storage and analytics.\n- Optionally, you can configure additional tooling to export logs to a SIEM.\n\nThe blueprint uses different log sources and includes these logs in the log sink\nfilter so that the logs can be exported to a centralized destination. The\nfollowing table describes the log sources.\n\nThe following table describes the log sinks and how they are used with\n[supported destinations](/logging/docs/routing/overview#destinations)\nin the blueprint.\n\nFor guidance on enabling additional log types and writing log sink filters, see\nthe [log scoping tool](/architecture/security-log-analytics#log_scoping_tool).\n\nThreat monitoring with Security Command Center\n----------------------------------------------\n\nWe recommend that you activate\n[Security Command Center](/security-command-center/docs/security-command-center-overview)\nPremium for your organization to automatically detect threats, vulnerabilities,\nand misconfigurations in your Google Cloud resources. Security Command Center creates\nsecurity findings from multiple sources including the following:\n\n- **[Security Health Analytics](/security-command-center/docs/how-to-use-security-health-analytics):** detects common vulnerabilities and misconfigurations across Google Cloud resources.\n- **[Attack path exposure](/security-command-center/docs/attack-exposure-learn):** shows a simulated path of how an attacker could exploit your high-value resources, based on the vulnerabilities and misconfigurations that are detected by other Security Command Center sources.\n- **[Event Threat Detection](/security-command-center/docs/how-to-use-event-threat-detection):** applies detection logic and proprietary threat intelligence against your logs to identify threats in near-real time.\n- **[Container Threat Detection](/security-command-center/docs/how-to-use-container-threat-detection):** detects common container runtime attacks.\n- **[Virtual Machine Threat Detection](/security-command-center/docs/how-to-use-vm-threat-detection):** detects potentially malicious applications that are running on virtual machines.\n- **[Web Security Scanner](/security-command-center/docs/how-to-use-web-security-scanner):** scans for OWASP Top Ten vulnerabilities in your web-facing applications on Compute Engine, App Engine, or Google Kubernetes Engine.\n\nFor more information on the vulnerabilities and threats addressed by\nSecurity Command Center, see [Security Command Center sources](/security-command-center/docs/concepts-security-sources).\n\nYou must activate Security Command Center after you deploy the blueprint. For instructions,\nsee [Activate Security Command Center for an organization](/security-command-center/docs/activate-scc-for-an-organization).\n\nAfter you activate Security Command Center, we recommend that you export the findings that\nare produced by Security Command Center to your existing tools or processes for triaging\nand responding to threats. The blueprint creates the `prj-c-scc` project with a\nPub/Sub topic to be used for this integration. Depending on your\nexisting tools, use one of the following methods to export findings:\n\n- If you use the console to manage security findings directly in Security Command Center, configure [folder-level and project-level roles](/security-command-center/docs/access-control-org#folder-level_and_project-level_roles) for Security Command Center to let teams view and manage security findings just for the projects for which they are responsible.\n- If you use Google SecOps as your SIEM, [ingest Google Cloud\n data to\n Google SecOps](/chronicle/docs/ingestion/cloud/ingest-gcp-logs).\n\n- If you use a SIEM or SOAR tool with integrations to Security Command Center, share data\n with [Cortex XSOAR](/security-command-center/docs/how-to-configure-scc-cortex-xsoar),\n [Elastic Stack](/security-command-center/docs/how-to-configure-scc-elastic-stack-docker),\n [ServiceNow](/security-command-center/docs/how-to-configure-scc-servicenow),\n [Splunk](/security-command-center/docs/how-to-configure-scc-splunk),\n or\n [QRadar](/security-command-center/docs/how-to-configure-scc-qradar).\n\n- If you use an external tool that can ingest findings from\n Pub/Sub, configure [continuous\n exports](/security-command-center/docs/how-to-export-data#continuous_exports)\n to Pub/Sub and configure your existing tools to ingest\n findings from the Pub/Sub topic.\n\nCustom solution for automated log analysis\n------------------------------------------\n\nYou might have requirements to create alerts for security events that are based\non custom queries against logs. Custom queries can help supplement the\ncapabilities of your SIEM by analyzing logs on Google Cloud and exporting\nonly the events that merit investigation, especially if you don't have the\ncapacity to export all cloud logs to your SIEM.\n\nThe blueprint helps enable this log analysis by setting up a centralized source\nof logs that you can query using a linked BigQuery dataset. To\nautomate this capability, you must implement the code sample at\n[`bq-log-alerting`](https://github.com/terraform-google-modules/terraform-google-log-export/tree/master/modules/bq-log-alerting)\nand extend the foundation capabilities. The sample code lets you regularly query\na log source and send a custom finding to Security Command Center.\n\nThe following diagram introduces the high-level flow of the automated log\nanalysis.\n\nThe diagram shows the following concepts of automated log analysis:\n\n- Logs from various sources are aggregated into a centralized logs bucket with log analytics and a linked BigQuery dataset.\n- BigQuery views are configured to query logs for the security event that you want to monitor.\n- Cloud Scheduler pushes an event to a Pub/Sub topic every 15 minutes and triggers Cloud Run functions.\n- Cloud Run functions queries the views for new events. If it finds events, it pushes them to Security Command Center as custom findings.\n- Security Command Center publishes notifications about new findings to another Pub/Sub topic.\n- An external tool such as a SIEM subscribes to the Pub/Sub topic to ingest new findings.\n\nThe sample has several [use\ncases](https://github.com/terraform-google-modules/terraform-google-log-export/blob/master/modules/bq-log-alerting/use-cases/README.md)\nto query for potentially suspicious behavior. Examples include a login from a\nlist of super admins or other highly privileged accounts that you specify,\nchanges to logging settings, or changes to network routes. You can extend the\nuse cases by writing new query views for your requirements. Write your own\nqueries or reference [security log analytics](/architecture/security-log-analytics#analyze_logs)\nfor a library of SQL queries to help you analyze Google Cloud logs.\n\nCustom solution to respond to asset changes\n-------------------------------------------\n\nTo respond to events in real time, we recommend that you use Cloud Asset Inventory to\n[monitor asset changes](/asset-inventory/docs/monitoring-asset-changes).\nIn this custom solution, an asset feed is configured to trigger notifications to\nPub/Sub about changes to resources in real time, and then\nCloud Run functions runs custom code to enforce your own business logic\nbased on whether the change should be allowed.\n\nThe blueprint has an example of this custom governance solution that monitors\nfor IAM changes that add highly sensitive roles including Organization Admin,\nOwner, and Editor. The following diagram describes this solution.\n\nThe previous diagram shows these concepts:\n\n- Changes are made to an allow policy.\n- The Cloud Asset Inventory feed sends a real-time notification about the allow policy change to Pub/Sub.\n- Pub/Sub triggers a function.\n- Cloud Run functions runs custom code to enforce your policy. The example function has logic to assess if the change has added the Organization Admin, Owner, or Editor roles to an allow policy. If so, the function [creates\n a custom security\n finding](/security-command-center/docs/how-to-api-create-manage-findings) and sends it to Security Command Center.\n- Optionally, you can use this model to automate remediation efforts. Write additional business logic in Cloud Run functions to automatically take action on the finding, such as reverting the allow policy to its previous state.\n\nIn addition, you can extend the infrastructure and logic used by this sample\nsolution to add custom responses to other events that are important to your\nbusiness.\n\nWhat's next\n-----------\n\n- Read about [preventative\n controls](/architecture/blueprints/security-foundations/preventative-controls) (next document in this series)."]]