Prepare and test your skills
Prepare and test your skills
Log-based monitoring for security events turns Cloud Audit Logs (opens in a new tab) entries into measurable signals and timely notifications. In this design, Cloud Logging collects and filters log entries, Cloud Monitoring evaluates alerting conditions, and notification channels deliver findings to responders and external systems. The goal is to record who did what, where, and when, then separate events that need immediate investigation from low-priority noise.
The reliable foundation for security alerting is Admin Activity audit logs, which are always written and cannot be configured, excluded, or disabled. These logs are still generated even if the Cloud Logging API is disabled, so alerts built on administrator activity do not go silent because of a configuration change. By contrast, Data Access audit logs must be explicitly enabled, can be very large, and can increase storage cost, so they are often excluded in development projects and enabled selectively in production. This creates a core tradeoff where Admin Activity alerts stay broad and mandatory while Data Access alerts stay narrowly scoped to high-value reads and exports.
Centralized monitoring depends on bringing identity events into the same place as resource events. Admin Activity audit logs from Cloud Identity and Google Workspace are ordinarily managed and viewed in the Google Admin console, separately from Google Cloud logs, but they contain user login events that are relevant to Google Cloud. Sharing Cloud Identity audit logs to the Google Cloud environment lets one set of filters and alerts cover both logins and resource changes. Once centralized, entries can be found in Logs Explorer by selecting the organization, choosing a resource type, and choosing a log name of activity, data_access, system_event, or policy.
A log-based monitoring pipeline moves data from log entries to human action in a fixed order. The pipeline depends on Cloud Logging to select events and on Cloud Monitoring to decide when to notify:
Policies should distinguish events that require immediate investigation from low-priority events rather than alerting equally on every match. For example, a policy can match a specific data-access message for an anomalous export and notify on each appearance, while a separate policy aggregates routine reads for dashboard review. Custom dashboards in Cloud Monitoring then track critical metrics over time, so teams see trends in failed logins, privilege changes, and data access alongside active alerts.
Critical security monitoring maps specific audit-log changes to attacker techniques and insider-risk patterns. Dedicated log metric filters paired with alerts should cover these patterns:
When any of these signals fires outside typical or expected patterns, the defined review process moves from detection to timely containment, privilege reversal, and audit-record preservation. Billing anomaly detection and budget alerts provide an independent early warning when log coverage is incomplete, because unexpected spend often appears when an attacker provisions resources.
Exam tip: Alert on Admin Activity for tamper-resistant coverage because those logs cannot be disabled, and scope Data Access alerts narrowly because that volume is large and billable.
Long-term detection and investigation depend on routing log data beyond the default log buckets. Using sinks, Cloud Logging routes selected logs to supported destinations including Cloud Storage for long-term preservation, BigQuery for detailed analysis, and Pub/Sub for streaming integration. Traffic flows from the sink to the Pub/Sub topic, and from the Pub/Sub subscription to a security information and event management (SIEM) tool or to Google Security Operations (opens in a new tab) for correlation. Security bulletin notifications and budget programmatic notifications can use the same Pub/Sub delivery pattern with filtering for the notification types to receive.
Retention and delivery reliability are controlled at the storage and contact layers. Cloud Logging retains logs in a log bucket according to custom retention rules from 1 day to 3650 days, with Bucket Lock used to enforce retention policies on log buckets so audit evidence cannot be deleted early. Critical security alerts flow from Cloud Monitoring to Essential Contacts configured as a monitored group alias or mailing list, so a compromise or account alert reaches an active team rather than an individual who may be unavailable.
Analysis of Data Access logs for anomaly detection and forensics is the practice of using Cloud Audit Logs (opens in a new tab) to answer who did what, where, and when across Google Cloud resources. Cloud Logging collects immutable log entries from Google Cloud services, and investigators correlate entries across services and time to find unauthorized access, misuse of permissions, and the sequence of events in a security incident. Data Access logs are central to this work because they record reads and writes to user data and configuration that Admin Activity logs do not cover.
Audit log types in Cloud Audit Logs differ by what triggers them and whether they must be enabled. Admin Activity logs record user-driven API calls that modify configuration or metadata, Data Access logs record reads of configuration and reads or writes of user-provided data, Policy Denied logs record denied access due to a security policy violation, and System Event logs record changes made by Google systems without user action. For identity and access investigations, Admin Activity logs and Policy Denied logs are the recommended starting point, with Data Access logs added to reveal data-level access patterns.
| Log type | Trigger | Investigative use |
|---|---|---|
| Admin Activity audit logs | User-driven change to configuration or metadata, always written and cannot be disabled or excluded | Track creation of VM instances, creation of service accounts, SetIamPolicy changes, and service account key downloads |
| Data Access audit logs | User-driven read or data operation, must be explicitly enabled in the IAM AuditConfig object | Track ADMIN_READ reads of configuration, DATA_READ reads of user data, and DATA_WRITE modifications of user data |
| Policy Denied audit logs | User or service account denied access by a security policy | Reveal attempted unauthorized access and repeated denials that precede or accompany an incident |
| System Event audit logs | Google Cloud system action, not driven by user action | Distinguish platform-driven changes from attacker-driven or administrator-driven changes |
A single Cloud Storage request can generate more than one audit entry because entries are generated from the IAM permissions checked to complete the request. Cloud Storage operations therefore map approximately, not one-to-one, to Admin Activity, ADMIN_READ, DATA_READ, and DATA_WRITE entries.
An audit log entry for forensics establishes the caller, the target, the action, and the time. Cloud Audit Logs stores the action taken by the user, where the activity occurred, and when it occurred, which lets an investigator link a principal to a method on a specific resource at a specific timestamp. Caller identity, caller IP address, resource type and labels, and protoPayload.methodName together show which account or service account invoked which API against which project, service account, or data object.
Correlation depends on pivoting across those fields over a timeframe. An investigator first fixes the time window around a suspected breach or IAM change, then filters by logName, such as projects/<PROJECT>/logs/cloudaudit.googleapis.com%2Factivity, by resource.type such as project or service_account, and by protoPayload.methodName such as SetIamPolicy. Because log entries are immutable, the resulting sequence can be trusted as a record of what was attempted and changed, including whether the entry came from Admin Activity, Data Access, or Policy Denied streams.
Analysis of IAM permission usage focuses on lifecycle events that grant, expand, or persist access. Admin Activity audit logs store creation of a service account, changes to IAM policy, and download or creation of a service account key, all of which are high-value signals for privilege escalation and persistence. Policy Denied audit logs complement them by recording when a user or service account is denied access to a Google Cloud service due to a security policy violation, which often reveals probing, excessive permissions, or controls working as intended.
Anomalies emerge when those signals deviate from expected patterns:
SetIamPolicy call that grants administrative roles outside a change window or from an unusual principal or IP address.Investigators use these patterns for two priority scenarios: analyzing permissions and access to resources during a data breach, and analyzing production issues caused by an IAM policy change to verify which user or process made the change. Sharing audit logs from Cloud Identity into Google Cloud centralizes user login events alongside resource logs, so an unusual login in the Admin console context can be joined to subsequent resource access in Cloud Logging. Identity and Access Management (IAM) (opens in a new tab) governance depends on joining that login signal to the later privilege use.
Correlation across services and timeframes is performed in Logs Explorer, the Cloud Logging API, and the command-line interface, with long-term analysis moved to exported storage. An investigator can view logs in the Google Cloud console under Logging and Logs Explorer for a selected project, or query entries programmatically with entries.list for repeatable forensic searches. All audit logs have a retention period, so enterprises that need longer history must create a log sink that routes entries to BigQuery or other sink destinations for storage over time and aggregate analysis.
A focused forensic query for IAM lifecycle events follows an ordered workflow:
resource.type and resource.labels.project_id to limit results to the project and service account resources.protoPayload.methodName to SetIamPolicy, google.iam.admin.v1.CreateServiceAccount, and google.iam.admin.v1.CreateServiceAccountKey to surface policy changes, new accounts, and new keys.Exporting to BigQuery lets the same investigation view a subset of columns and selected data over time or other dimensions, which is necessary when an incident spans projects, folders, or an organization. Google Cloud projects contain only audit logs for resources directly within the project, while folders, organizations, and billing accounts contain logs for the entity itself, so organization-level correlation requires querying at the correct hierarchy level and retaining enough history to cover the full attack timeline.
Exam tip: The Logs Viewer role (roles/logging.viewer) grants read-only access to Admin Activity, Policy Denied, and System Event logs but cannot view Data Access logs in the _Default bucket; reading Data Access logs in the _Default bucket requires the Private Logs Viewer role (roles/logging.privateLogViewer).
Forensic capability depends on preserving logs and converting repeated patterns into alerts. Organizations set up policies and procedures to monitor administrator activities and create log-based alerts in Cloud Logging to flag suspicious API requests such as unauthorized VM creations or IAM privilege escalations. Because Admin Activity logs are always written even if the Cloud Logging API is disabled, alerting on them provides a durable baseline, while explicitly enabled Data Access logs provide the data-level visibility needed to confirm whether accessed data was actually read or modified.
A log sink in Cloud Logging (opens in a new tab) is a routing rule that sends copies of log entries that match a filter to a supported destination for retention, analysis, or forwarding. Log entries flow from the originating project, folder, or organization to the sink, and the sink then writes matching entries to its configured destination. Routing does not remove the original entries from Cloud Logging, so retention, encryption, and cost controls still apply in both places.
Routing audit logs gives longer preservation and stronger analysis than keeping logs only in their originating log buckets. Organizations route copies of audit logs to meet compliance requirements for creation and preservation, to keep logs beyond the bucket retention period, and to enable powerful search and centralized security analysis. A sink can route some or all logs, so critical security events can be preserved centrally while noisy, low-value volume is filtered out.
Routing also solves scale across many projects. An organization with dozens or hundreds of projects cannot practically check each project bucket, so it uses centralized routing to collect audit logs in one place. This central copy then supports investigation, compliance reporting, and forwarding to analytics platforms and third parties.
Cloud Logging sinks route audit logs to Cloud Storage, BigQuery, Pub/Sub, and Cloud Logging buckets. Each destination receives data from the sink and serves a different operational need, from low-cost preservation to real-time forwarding and interactive analysis.
| Destination | Receives data from | Choose when |
|---|---|---|
| Cloud Storage | Sink writes log files to a storage bucket | Long-term, low-cost preservation and compliance archiving are required |
| BigQuery | Sink writes log entries to a BigQuery dataset | Powerful SQL search and long-term analytics across large audit log volumes are required |
| Pub/Sub | Sink publishes log entries to a Pub/Sub topic | Logs must flow to other applications, other repositories, third parties, or a third-party SIEM |
| Cloud Logging bucket | Aggregated sink writes logs to a central logging bucket | Centralized analysis with Observability Analytics across the organization is required |
Traffic flows from the sink to only its configured destination, and downstream systems depend on that destination. A third-party SIEM pulls logs after the sink aggregates them in Pub/Sub or Cloud Storage, while Google Security Operations can use built-in direct ingestion for a predefined subset of logs or receive an expanded set through a sink. If a central Logging bucket or central BigQuery dataset already exists, reuse that single destination and update the existing aggregated sink with the audit log filter instead of creating parallel destinations.
An aggregated sink is a sink created at the organization or folder level that routes logs from any or all child Google Cloud projects to one destination. Log entries flow from each child project up to the aggregated sink, and the sink then writes them to the central Cloud Storage bucket, BigQuery dataset, Pub/Sub topic, or Logging bucket. This structure lets a central security team own one destination and one set of access controls while still capturing activity from the entire resource hierarchy.
Deploying an aggregated sink follows an ordered dependency chain where each step depends on the previous one:
Sink filters and exclusions control which audit logs are routed and which are discarded to manage log volume and cost while preserving critical security events. The filter on a sink selects matching entries for delivery, while an exclusion prevents matching entries from being stored in Cloud Logging or routed onward. Because Data Access audit logs record read operations and can be very large, they are the primary driver of volume and storage cost.
Admin Activity audit logs are always written and cannot be configured, excluded, or disabled, even if the Cloud Logging API is disabled. Data Access audit logs are optional and high-volume, so exclusions are normally applied to Data Access logs rather than to Admin Activity logs. A common tradeoff is to retain all Data Access logs for authentication and authorization services and for production storage systems, while excluding Data Access logs in development projects where the volume has little security value.
Exam tip: Admin Activity audit logs cannot be excluded or disabled, while Data Access audit logs can be excluded to control volume and cost.
Retention for audit logs kept in Cloud Logging is governed by the log bucket where the logs are held, not by the log type. Custom retention can be configured between 1 day and 3650 days to meet compliance needs, and a custom rule applies to all logs in the bucket regardless of log type or whether the log was copied from another location. Logs routed to Cloud Storage, BigQuery, or Pub/Sub (opens in a new tab) are subject to those services' own storage and pricing in addition to Cloud Logging retention.
By default, Cloud Logging encrypts customer content stored at rest with Google-managed keys. When an organization has advanced encryption requirements, it configures customer-managed encryption keys (CMEK) to control and manage the key encryption keys that protect log storage. The log bucket depends on the CMEK configuration, so loss of access to the key affects access to the stored audit logs.
Cost control depends on estimating usage and excluding low-value logs before they consume allotments and storage. Data Access audit logs can push projects over log allotments and incur additional storage charges in Cloud Logging and in routed destinations. Effective practice is to view usage data, configure alerting on usage and billing, and apply exclusions to audit logs that are not useful for security or compliance.
Admin Activity audit logs in Cloud Audit Logs are always written and cannot be configured, excluded, or disabled even if the Cloud Logging API is disabled, while Data Access audit logs must be explicitly enabled in the Identity and Access Management (IAM) AuditConfig object and record ADMIN_READ, DATA_READ, and DATA_WRITE operations. Admin Activity audit logs record user-driven changes to configuration or metadata, while Data Access audit logs record reads of configuration and reads or writes of user-provided data and can be very large and increase storage cost.
A Cloud Logging sink routes matching audit log entries to Cloud Storage for long-term, low-cost preservation and compliance archiving, to BigQuery for powerful SQL search and long-term analytics across large audit log volumes, to Pub/Sub for streaming to other applications, other repositories, third parties, or a security information and event management (SIEM) tool, and to a central Cloud Logging bucket for centralized analysis with Observability Analytics across the organization. Routing does not remove the original entries from Cloud Logging, so retention, encryption, and cost controls still apply in both places.
Security event alerting flows from Cloud Logging filtering audit log entries and counting matches as a log-based metric or evaluating a log-based alerting condition, to Cloud Monitoring evaluating the alerting policy and firing an incident when the described condition occurs, to delivery of the incident to notification channels such as a monitored group email, Pub/Sub topic, or custom dashboard in Cloud Monitoring. Policies should distinguish events that require immediate investigation from low-priority events rather than alerting equally on every match.
The Logs Viewer role grants read-only access to Admin Activity, Policy Denied, and System Event logs but cannot view Data Access logs in the _Default bucket. Reading Data Access logs in the _Default bucket requires the Private Logs Viewer role.
A security engineer is designing an enterprise-wide audit logging architecture across a Google Cloud Organization. The design must satisfy the following technical and operational requirements:
Which logging architecture should the engineer implement?
Create project-level sinks routing audit logs to Cloud Storage buckets for near real-time SIEM export; create an aggregated sink routing to a write-enabled BigQuery dataset; and modify the _Required sink to exclude Data Access audit logs.
Create an organization-level aggregated sink routing audit logs to a Pub/Sub topic for SIEM ingestion; create an organization-level aggregated sink routing audit logs to a linked BigQuery dataset; and add exclusion filters on the _Default sinks to drop high-volume Data Access logs.
Create an organization-level aggregated sink routing audit logs to a Pub/Sub topic for SIEM ingestion; create an organization-level aggregated sink routing audit logs to a standard, write-enabled BigQuery dataset; and configure exclusion filters on the _Default sinks in projects to exclude high-volume Data Access logs.
Create an organization-level aggregated sink routing audit logs to a Pub/Sub topic for SIEM ingestion; create an organization-level aggregated sink routing audit logs to a standard BigQuery dataset; and disable the _Required log sink in child projects to reduce log ingestion costs.
Last updated