Prepare and test your skills

Prepare and test your skills

Cloud Monitoring (opens in a new tab) alerts based on resource metrics turn utilization measurements into notifications and corrective action. An alerting policy watches time-series data, compares it to a threshold for a set duration, and sends a notification through a notification channel when the condition holds. The flow runs from metric collection to threshold evaluation to administrator notification to resource adjustment, which connects monitoring to availability and performance management.
How alert policies create alerts is a fixed flow from policy to alert to notification channel. First, an alerting policy describes what to watch and who to notify, including the data source, threshold, and aggregation settings. When the data meets the condition, Monitoring creates an alert as a record of what was monitored and when, and the alert flows to a notification channel that delivers by email, Slack, or another destination. Resource Manager (opens in a new tab) provides the hierarchy of Organization to Folders to Projects to Resources, so contacts set at the organization or folder level automatically apply to child projects and resources. Essential Contacts carries critical billing, security, and legal notifications through that hierarchy, and reliable delivery depends on configuring a group email alias at the organization or folder level instead of relying on default IAM fallback roles.
A left-to-right process flow showing time-series metrics evaluated by an alerting policy, creating an alert that goes through a notification channel to administrator action and resource adjustment.
Metric selection and threshold configuration defines when a policy should fire. Selection starts with a resource type, metric category, and specific metric, such as VM instance CPU Utilization, Bigtable storage utilization, or Spanner CPU Utilization by priority, plus filters and grouping to narrow the time series. The threshold has a position and value, such as latency higher than two seconds, Bigtable storage above 70, or Spanner high-priority CPU above 45% for multi-region instances and above 65% for regional instances. A retest window and rolling window, such as a 10-minute retest with a 10-minute rolling mean, require the violation to persist so brief spikes do not trigger alerts.
Raw points are first aligned into regular intervals and then aggregated before comparison. Common functions include mean value, maximum value, rate of change, and ratio or forecast comparison. Grouping controls how many points are evaluated: aggregating 100 VMs that belong to five services to the service level returns 5 points, while aggregating to the VM level returns 100 points. Time-series condition types differ by trigger pattern:
| Condition type | When the condition is met | Example use |
|---|---|---|
| Metric-threshold condition | Value is more than or less than a static threshold for a retest window | Latency at 500ms or higher over 10 minutes |
| Metric-absence condition | Time series has no data for a retest window, up to 24 hours | No HTTP requests over five minutes |
| Prometheus Query Language (PromQL) condition | Custom PromQL expression is true | Ratio of two metrics or more than 25 hours of data |
| Forecasted metric-value condition | Forecast predicts a violation within 1 hour to 7 days | Disk likely to reach 80% within 24 hours |
Exam tip: Filter on monitored-resource labels for stable selection, and do not depend on resource metadata labels for sensitive policies because metadata arrives asynchronously.
Continue with this study guide: Creating Cloud Monitoring alerts based on resource metrics
Custom metrics (opens in a new tab) in Cloud Monitoring capture application-level telemetry that built-in metrics cannot measure, such as widgets sold or daily sales per store. Data flows from instrumented application code to the Cloud Monitoring API to stored time series in a Google Cloud project, and then to charts, dashboards, and alerting policies. Once stored, a user-defined metric works like a built-in metric for charting, reading, and alerting.
A metric descriptor is the definition that tells Cloud Monitoring how to organize and interpret incoming data. The descriptor specifies its type string, description, metric kind, value type, unit, and labels, and it can be created explicitly before writing data or automatically from the first written points. A custom metric name is a unique type string that starts with a required prefix:
custom.googleapis.com/ for metrics written directly through the APIworkload.googleapis.com/ for workload-specific metricsexternal.googleapis.com/user for user-defined external metricsexternal.googleapis.com/prometheus for Prometheus-format metricsThe full descriptor name adds project scope as projects/PROJECT_ID/metricDescriptors/METRIC_TYPE. Value settings give precise meaning: metricKind describes whether values are instantaneous like GAUGE or changes over time like DELTA, valueType describes the format like DOUBLE or 64-bit integer, and labels like store_id split one metric into one time series per label value. A monitored resource identifies the source, and best practice is to write against the same resource type where the code runs. The Ops Agent (opens in a new tab) choice controls collision risk: generic_node and generic_task have labels that support filtering and aggregation, while global has only project_id so many writers can collide. The API uses metricDescriptors.create to define the metric, timeSeries.create to send timestamped points, and timeSeries.list to read data, and write and delete operations work only for user-defined metrics.
Agent-based and open-source ingestion extends monitoring beyond automatic Google Cloud system metrics. The Ops Agent runs on Compute Engine virtual machines (VMs) to collect host and application telemetry, while Prometheus and OpenTelemetry let applications expose custom metrics that flow to Cloud Monitoring. On Compute Engine, the Ops Agent automatically collects host metrics for CPU, GPU, memory, disk, swap, and processes plus system logs, and it adds application coverage through receivers and pipelines for third-party software such as Postgres, MongoDB, Apache, MySQL, and Redis.
Third-party integrations and the Prometheus receiver differ in namespace, curation, and cost. An integration writes workload.googleapis.com metrics with a curated set and prebuilt dashboard with byte-based pricing at 8 bytes per data point. The Prometheus receiver scrapes a Prometheus endpoint on the VM and writes prometheus.googleapis.com metrics with no curated dashboard and sample-based pricing based on samples, buckets, frequency, and hosts. For Kubernetes and serverless work, Google Cloud Managed Service for Prometheus handles collection: managed collection uses an operator for GKE, self-deployed collection reuses existing Prometheus binaries, the OpenTelemetry Collector can send metrics, logs, and traces from any environment, and Cloud Run uses a Prometheus or OpenTelemetry sidecar.
Log-based metrics turn text in Cloud Logging into numeric time series in Cloud Monitoring. Data flows from log entries received by Cloud Logging through a filter to time-series data stored by Monitoring for charts and alerting. Log-based metrics collect data only from entries received after the metric is created and never backfill history. System metrics use names like logging.googleapis.com/SYSTEM_METRIC_NAME and user metrics use logging.googleapis.com/user/USER_METRIC_NAME.
| Metric type | What it records | Choose when |
|---|---|---|
| Counter metric | Number of matching log entries per interval | You need frequency of errors, warnings, or operations by label |
| Distribution metric | Count, mean, sum of squared deviations, and histogram bucket counts for extracted numbers | You need spread, average, or trends for latencies or value ranges |
Labels split one metric into many series, such as USERNAME and OPERATION extracted from log text, and a single resource type such as gce_instance should be specified so the metric appears correctly for charts and alerts.
Log sinks and export mechanisms (opens in a new tab) are routing rules that send copies of incoming log entries from Cloud Logging to storage and analysis destinations. Each sink lives in the Log Router and pairs a filter with a destination, so data flows from the ingestion pipeline to the sink and then to the destination. Because routing happens at ingestion time, one entry can match more than one sink and be sent to multiple destinations at once.
How log sinks route data is an ingestion-time test where each sink checks every incoming entry against its filter and forwards matches. The project includes a preconfigured _Default sink, and in a centralized design sinks in many projects forward to buckets in one central project. An inclusion filter selects entries for export, while an exclusion filter drops entries to reduce volume and cost. If exported scope looks too large, another sink may still include entries that one sink excludes.
Export paths differ by use. Exporting to BigQuery routes rows to tables in a dataset for SQL analysis, and if an alert interrupts routing, Logging creates backfill_ tables that must be merged into the original tables and then deleted to prevent duplicates. Exporting to on-premises and external systems moves data across the cloud boundary through collectors: Fluentd and Fluent Bit read inputs from VMs and containers and send through output plugins to BigQuery, Elastic, and Splunk. Re-import reverses the flow through a Cloud Run job that reads objects from Cloud Storage, selects logs by identifier and time range, converts them to LogEntry batches, and writes them to Cloud Logging where routing applies again.
Secure log export is the set of identity, network, encryption, and governance controls that decide who can move logs and where they can go. Identity and Access Management (IAM) controls who can create, view, and stop exports, and an export job inherits the visibility of the user who starts it so a user cannot export logs they cannot read. The workflow depends on two identities: the user identity authorizes the request and the service account carries data to the destination bucket. BigQuery adds fine-grained control with dataset and table roles plus authorized views and policy tags for rows and columns.
Network and encryption controls protect movement and storage. Virtual Private Cloud (VPC) and private connections such as Private Service Connect keep traffic on private paths, while regionalized buckets and disabled default sinks keep data in approved regions. Cloud Logging and BigQuery encrypt by default, with support for customer-managed keys in Cloud Key Management Service (KMS) and column-level encryption. Governance adds boundaries: sensitive application data can stay on-premises while operations telemetry streams to the cloud, and in Assured Workloads folders filters must not contain customer data and SQL alerting is disabled.
| Destination | Storage model | Analysis and retention tradeoff |
|---|---|---|
| BigQuery | Managed tables with partitioning and clustering | SQL analysis and long-term retention; requires API, writer roles, and matching dataset location |
| Cloud Storage bucket | Partitioned folders and CSV shards up to 100 MB | Bulk archive and re-import; up to 100 TB per job, 3 jobs per tenant, 30-day limit on re-imported timestamps |
| On-premises and third-party via Fluentd or Fluent Bit | External systems such as Elastic, Splunk, Prometheus, and Grafana | Keeps data outside Google Cloud but needs separate logging setup with no Google support |
Exam tip: An export job inherits the visibility of the user who starts it, so a user cannot export logs they are not already allowed to read.
Continue with this study guide: Exporting logs to external systems (e.g., on-premises, BigQuery)
Log routing and sink implementation (opens in a new tab) in Cloud Logging directs each log entry to storage or analysis. The Log Router evaluates every incoming entry against configured sinks, and each matching sink sends a copy to its destination. This design separates log generation from storage, so logs from a project, folder, or organization can be centralized in Cloud Storage, BigQuery, Pub/Sub, or Cloud Logging buckets.
How log routing directs entries is a flow from monitored resource to ingestion to each matching sink to its destination. A sink depends on a filter that selects entries, a destination that receives them, and IAM permission that allows writing. Sinks can be created at project, folder, organization, and billing account level, so folder or organization entries can be routed to a central project bucket for retention longer than the 30-day default. A log sink uses an inclusion filter to select entries and exclusion filters to remove unwanted entries, with up to 20,000 characters per filter and up to 50 exclusion filters per sink. Routing destinations include Cloud Storage for archive, BigQuery dataset for SQL analysis, Pub/Sub topic for real-time delivery, and Cloud Logging bucket for indexed storage with retention from 1 day to 3650 days. Sink capacity is limited to 200 sinks per project, increasable to 4,000 on request, with separate quotas for billing accounts, folders, and organizations.
A log bucket is a regional container that holds, indexes, and makes entries searchable with one retention rule for all logs it holds. Buckets can be customized by region, retention, and encryption including customer-managed encryption keys (CMEK). Retention and location differ by bucket type:
| Bucket | Location level | Default retention | Retention configurable |
|---|---|---|---|
| _Required | project, folder, organization | 400 days | No |
| _Default | folder, organization | 30 days | No |
| _Default | project | 30 days | Yes, 1 to 3650 days |
| User-defined | project | 30 days | Yes, 1 to 3650 days |
To keep folder or organization logs longer than 30 days, route them with a sink to a project bucket with longer retention. A bucket upgraded for analytics has an active link to a linked BigQuery dataset, which enables SQL queries, and the bucket cannot be deleted until the link is deleted with gcloud logging links delete. Locking a bucket with --locked is irreversible and locks retention, and deletion moves the bucket to DELETE_REQUESTED for 7 days during which the name cannot be reused and the bucket still counts toward quota.
Exam tip: A sink allows a maximum of 50 exclusion filters and this limit cannot be increased — refine the inclusion filter instead.
Continue with this study guide: Configuring log buckets, log analytics, and log routers
Logs Explorer (opens in a new tab) is the Google Cloud console interface for viewing and filtering log entries stored in Cloud Logging. Logs Explorer lets you set a project, folder, or organization scope and then narrow results by resource type, log name, and query fields. Each log entry is a LogEntry with indexed fields such as resource.type and logName that the interface uses for filtering.
Opening Logs Explorer and setting scope defines which logs you can see. Go to the Logs Explorer page, use the Project selector to choose a project, folder, or organization, and all later choices apply only inside that scope. Filtering by resource type and log name then isolates one system, such as a Compute Engine instance or Kubernetes cluster and one log stream. The Query builder exposes audit choices for activity for Admin Activity, data_access for Data Access, system_event for System Event, and policy for Policy Denied logs. Time-based correlation narrows to the window around a failure and reads entries in timestamp order, so spikes, gaps, and repeating errors become visible and warnings can be lined up with errors and audit actions.
The Logging Query Language (LQL) is the filter language that selects specific entries in the query pane and in commands. Field filters name the exact field and value, such as resource.type="cloudsql_database" or resource.labels.service_name="$SERVICE_NAME" for a Cloud Run service. The operator = requires an exact match, : matches log-name or text content, and != excludes a value, while AND, OR, and parentheses combine conditions with OR grouped first. The same filter string runs in the console and in the Google Cloud CLI as gcloud logging read. A basic audit workflow follows this order:
logName:"cloudaudit.googleapis.com" and run the query.resource.type, severity, or message pattern.Exam tip: If activity, data_access, system_event, or policy does not appear in the Log name menu, logs of that type are not currently available in the selected scope.
Continue with this study guide: Viewing and filtering logs in Cloud Logging
A log entry in Cloud Logging (opens in a new tab) is a LogEntry object that records a single event from a monitored resource. A log is a collection of entries, and each entry applies to one monitored resource type. Reading timestamp, severity, resource type, labels, and payload together shows what happened, where it happened, and how serious it was.
Core components of a log entry combine context metadata with message content. Timestamp records when the event occurred while receiveTimestamp records when Logging received it, severity supports filters such as severity >= "ERROR", resource fields identify the source, labels add key-value context, and trace links related entries. Kubernetes entries use k8s_control_plane_component for control plane replicas, k8s_node for worker services like kubelet and containerd, and k8s_container for workload containers including system namespaces. The payload type determines detail:
| Payload field | What it holds | What it reveals |
|---|---|---|
textPayload | Single string message | Basic event text or multi-line stack trace |
jsonPayload | Named JSON fields such as message and stack_trace | Structured detail that can be filtered and searched |
protoPayload | AuditLog object for audit logs | Who did what to which resource, with service name and auth info |
A build message goes to textPayload when only mappable fields are present and to jsonPayload.message when extra fields are present. An audit entry is distinguished by protoPayload containing an AuditLog object, with suffixes activity, data_access, system_event, and policy.
Contextual information and trace integration connects one log to its larger request. The trace field holds the trace identifier, traceSampled records whether tracing was kept, and resource and latency fields link the entry to its resource and position in the trace. In Logs Explorer, View trace details shows parent and child spans, Show all logs for this trace lists every log with the same trace, and Show only traced requests filters to traceSampled equal to True. From Trace explorer, selecting a span and opening Logs and Events returns to the same logs. Pinning keeps one entry centered while filtering to same resource.type, same labels, or same trace.
Error grouping depends on field order. Error Reporting checks jsonPayload fields in the order stack_trace first, then exception, then message, and a message without a recognizable stack trace may be visible but will not group correctly.
Exam tip: An audit log entry is distinguished by its protoPayload field containing an AuditLog object, not by timestamp or severity alone.
Continue with this study guide: Viewing specific log message details in Cloud Logging
Distributed tracing and latency analysis (opens in a new tab) follows one user request through many services and splits total time into timed parts to find delays. Cloud Trace is the Google Cloud distributed tracing system that collects latency data and shows it in near real time in the console. When a request flows from frontend to backend to database, Cloud Trace records the journey as a trace where each timed span shows which step added delay.
Cloud Trace works with logging and metrics as part of Google Cloud Observability. Cloud Logging stores event records, Cloud Monitoring collects CPU, memory, and response-time data, and Cloud Trace shows how long a specific request took across services. Scope checking decides whether slowness is widespread or rare: for Cloud Run use the METRICS tab Request latencies dashboard or the metric Cloud Run Revision > Request_latencies, and for App Engine compare 50th, 95th, and 99th percentile latency. High values on all three mean at least half of requests are slow, while high 99th percentile alone means about 1% are slow. The workflow moves in order:
A trace span much longer than the others identifies the bottleneck, often a call to a database or downstream API. Correlated logs link entries to traces through identifiers, and the traceSampled=true filter in Logging finds only requests with trace data. Increasing minimum instances keeps instances warm, while App Engine adds instance class, warmup requests, and dynamic scaling controls.
Database query performance work finds slow queries and speeds retrieval with better indexes. Query Insights for Cloud SQL and AlloyDB detects inefficient queries through load charts, top queries by load, and active query views over 1 hour to 30 days or a custom range. From the instance page, open Query Insights, set the time range, and zoom into high-load spikes, then terminate long-running or blocked queries if needed. An AI-assisted investigation from Investigate performance compares a selected period to a baseline: periods under 24 hours analyze the whole period, periods over 24 hours analyze only the last 24 hours, and Monday selections compare to the 7th day previous. Results show Issue, Observations such as lock contention, and Hypotheses for next actions.
The index advisor inside Query Insights recommends CREATE INDEX commands with performance impact rated high, medium, or low, tables impacted, storage needed, and number of impacted queries. For AlloyDB, open Clusters, then Query Insights, then Queries, then Create Indexes, review impacted queries, copy all index commands, and run them on the primary instance. Cloud Profiler handles code-level cost: it is a statistical, low-overhead profiler that continuously samples production CPU and memory for Go, Java, Python, and Node.js and attributes use to source lines. Flame graphs show expensive functions, with focused, compared, and historical views to confirm fixes before adding larger machines.
Exam tip: A latency spike must be judged against its time window — a large spike in a small window can be negligible in a larger window.
Personalized Service Health (PSH) (opens in a new tab) events are tailored status updates about Google Cloud disruptions that affect a specific project or organization. The Service Health dashboard in the console is the main place to view these events, while the Service Health API, alerts, and logs deliver the same information to other tools. Each event describes its state, start and end times, impacted products and locations, and progress updates so operators can tell whether a problem comes from their project or from Google Cloud.
Global and personalized views differ in audience, scope, and actionability. The global public dashboard shows overall status for all customers, while Personalized Service Health filters to incidents affecting resources in active projects. An incident can appear globally without affecting a specific project, so check the global view for awareness and the personalized view to confirm impact.
| View | Audience and access | What it shows |
|---|---|---|
| Personalized Service Health (PSH) | Signed-in view for projects or organization via console, API, and Cloud Logging | Emerging, active, updated, and past events relevant to those projects |
| Google Cloud Service Health (CSH) | Public view with no login via dashboard and RSS feed | Broad Severe incidents plus status during PSH disruption |
Broad Severe incidents have global impact or affect many projects across regions, are marked Service outage, and receive a public report, while limited-scope incidents affect a single location or subset and may receive a nonpublic report. Relevance values RELATED, IMPACTED, and PARTIALLY_RELATED filter to services in use, and FALSE_POSITIVE events are excluded. Organization Views aggregates the same data across an organization instead of checking projects one by one.
Access and notifications depend on Identity and Access Management (IAM), Cloud Logging, and Cloud Monitoring. Console viewing needs IAM sign-in, programmatic access needs the enabled Service Health API, and alerts flow from health events written to Logging to a Monitoring alerting policy to a channel such as mobile or PagerDuty. Conditions can trigger when new incidents are reported, when incidents are updated, or when specific products or locations are affected. If no alert fires, check relevance first and then policy filters, because a policy with the wrong product, location, or condition can miss visible events. API calls fail with 403 PERMISSION_DENIED and SERVICE_DISABLED when the API is not enabled.
Exam tip: Personalized Service Health will not send a notification if an incident has a relevance of Unknown, even if alerting is otherwise configured.
Continue with this study guide: Viewing the Personalized Service Health dashboard
Deploying the Ops Agent (opens in a new tab) across compute environments means installing, verifying, and maintaining one agent that collects telemetry from virtual machines (VMs). The Ops Agent runs on Compute Engine instances and Bare Metal Solution servers and combines logs, metrics, and traces in a single process. Data flows from the agent on each VM to Cloud Logging for logs and to Cloud Monitoring for metrics, using Fluent Bit for high-throughput logging and the OpenTelemetry Collector for metrics and traces.
Prerequisites ensure the VM can authenticate and reach observability services. The VM must run a supported Linux or Windows system, its service account needs Logs Writer (roles/logging.logWriter) and Monitoring Metric Writer (roles/monitoring.metricWriter), the Logging and Monitoring APIs must be enabled, and legacy agents must be removed because running both causes duplicate logs and conflicting metrics. Automatic installation during VM creation uses VM Manager and OS Config with Compute Instance Admin and OSPolicyAssignment Editor roles and the Install the Ops Agent checkbox under Observability. Command-line installation adds the Google package repository and installs the package, pinning to a major version such as 2.*.* to avoid breaking upgrades. Fleet installation uses one OS Config agent policy or tools such as Ansible, Chef, Puppet, or Terraform, or the Monitoring VM Instances list to Install/Update Ops Agent.
Verifying health confirms telemetry flow. On Linux, sudo systemctl status google-cloud-ops-agent"*" should show Logging and Metrics agents running, while on Windows Get-Service google-cloud-ops-agent should show Running. The dashboard Agent column shows Ops Agent for running, Pending for in-progress work over 10 minutes, Not Collecting Telemetry when no data has arrived after about 10 minutes, and other states for missing, failed, legacy, unsupported, or stopped cases.
Configuring the Ops Agent means editing one unified YAML file that controls both signals. Both metrics and logs are enabled by default, so basic health flows once the agent runs with valid credentials. The log pipeline moves data from receivers through processors to the Logging API, with support for system logs, file paths, journald, TCP, Forward protocol, JSON and regex parsing, field modification, exclusion, multiline concatenation for Java, Python, and Golang, and curated third-party integrations. The metric and trace pipeline uses the OpenTelemetry Collector for system metrics for CPU, memory, disk, network, processes, and agent self-metrics plus Windows IIS, MSSQL, and pagefile, Linux GPU, third-party metrics, Prometheus endpoints, OTLP metrics and traces, and NVIDIA DCGM metrics. The agent requires outbound access to oauth2.googleapis.com, monitoring.googleapis.com, and logging.googleapis.com plus install hosts, and local TCP ports 20201 and 20202 for internal communication without external opening.
Exam tip: Do not run the Ops Agent on a VM that still has a legacy Logging or Monitoring agent installed — remove the legacy agents first.
Continue with this study guide: Configuring and deploying Ops Agent
Google Cloud Managed Service for Prometheus (opens in a new tab) is a fully managed monitoring solution that separates collection from global storage and querying. Collectors scrape Prometheus exporters in Kubernetes, VM, or serverless environments and forward data to Monarch, the globally scalable datastore that stores data for 24 months and answers PromQL queries. Both collection modes send to Monarch, but they differ in who operates collectors and how scraping is configured.
Managed collection is the recommended operator-driven method for Kubernetes including Google Kubernetes Engine (GKE). A Kubernetes operator installs in-cluster components that generate scrape configs, scale ingestion, and scope rules, with data flowing from exporter endpoints to a local collector to Monarch in a region. It is enabled by default on GKE Autopilot 1.25 and greater and GKE Standard 1.27 and greater, with automatic upgrades and full support. Self-deployed collection lets you operate your own Prometheus servers with a drop-in replacement binary that scrapes locally, evaluates rules locally without cloud traffic, and forwards to Monarch, with manual scaling and limited support but support for migration and local aggregation to control cardinality.
| Option | Who operates collectors | How scraping is configured | Best use case |
|---|---|---|---|
| Managed collection | Kubernetes operator manages configs, scaling, and upgrades | PodMonitoring, ClusterPodMonitoring, ClusterNodeMonitoring | New or standard GKE work wanting hands-off operation |
| Self-deployed collection | You deploy, scale, and shard servers manually | Existing configs, annotations, or prometheus-operator | Complex existing setups, migration, edge local evaluation |
Managed collection needs scraping resources before any metrics flow. The gmp-operator Deployment builds configuration and the collector DaemonSet scrapes and forwards, with each collector scraping only pods on its own node. PodMonitoring is namespace-scoped and discovers pods in one namespace via spec.selector.matchLabels with endpoints for port, path such as /metrics, and interval such as 30s. ClusterPodMonitoring uses the same selector and endpoint model but discovers matching pods across all namespaces for shared services. Global querying runs in Monarch, which unions results across regions and up to 3,500 projects in a metrics scope. Grafana points at Monarch through the Prometheus query API so one instance views Kubernetes, VM, Cloud Run, on-premises, and multi-cloud data together. In Cloud Monitoring Metrics Explorer, PromQL can query Managed Service metrics plus over 6,500 free Google Cloud metrics, free Kubernetes metrics, custom metrics, and log-based metrics without sending data to the managed service.
Exam tip: PodMonitoring scrapes only pods in its deployed namespace, while ClusterPodMonitoring scrapes matching pods across all namespaces.
Continue with this study guide: Deploying Google Cloud Managed Service for Prometheus
Cloud Audit Logs (opens in a new tab) records who did what, where, and when in Google Cloud. Each project, folder, and organization has audit streams, and each entry is a LogEntry whose protoPayload holds an AuditLog object. Resources that can be accessed without logging into a Google Cloud, Google Workspace, Cloud Identity, or Drive Enterprise account do not generate audit logs.
Audit categories answer different questions about configuration, data, system actions, and denials. Admin Activity logs record configuration or metadata changes such as creating VMs or setting IAM policies and are always enabled. Data Access logs record reads of configuration or metadata plus user-driven creation, modification, or reads of user data and are disabled by default except for BigQuery because they can grow very large. System Event logs record changes by Google Cloud systems such as autoscaling additions, are always written, and cannot be configured, excluded, or disabled. Policy Denied logs record blocked access due to security policy, are generated by default with storage charges, cannot be disabled, but can be excluded from storage with exclusion filters.
| Log type | What triggers the log | Default and control |
|---|---|---|
| Data Access | Access to data in the accessed project | Disabled by default except BigQuery; must be explicitly enabled |
| System Event | Change by Google systems, not direct user action | Always written; cannot be configured or disabled |
| Policy Denied | Denied access due to policy violation | Generated by default; cannot be disabled but can be excluded from storage |
Enabling Data Access logs per service adds visibility only where required, such as storage or database services with sensitive data. When enabled, the service writes entries to Cloud Logging where IAM controls viewing through Logs Explorer, the API, and CLI. Volume is managed with principal-based exemptions that exclude a high-volume service account while keeping coverage for others, plus sink exclusion filters that drop low-value entries from storage or export. Viewing, retention, and export use Logs Explorer, the API, CLI, or Activity page, with longer retention in Cloud Storage for compliance, BigQuery for large-scale analysis, and Pub/Sub for streaming to security tools.
Roles split viewing from configuration. Logs Viewer (roles/logging.viewer) grants Admin Activity, Policy Denied, and System Event logs but cannot view Data Access logs in _Default. Private Logs Viewer (roles/logging.privateLogViewer) grants all logs in _Required and _Default including Data Access. Configuring Data Access at the project level requires roles/owner because the change updates the IAM policy auditConfigs section, such as adding service: storage.googleapis.com with ADMIN_READ, DATA_WRITE, and DATA_READ. The workflow reads the policy with gcloud projects get-iam-policy, edits only auditConfigs while preserving bindings and etag, and writes it back with gcloud projects set-iam-policy.
Exam tip: Admin Activity logs are always enabled, while Data Access logs are disabled by default except for BigQuery.
Continue with this study guide: Configuring audit logs
Gemini Cloud Assist (opens in a new tab) for Cloud Monitoring analyzes health metrics, logs and traces, and alert and incident events together to explain health, performance, and reliability. Health metrics show utilization, latency, and errors over time, logs provide diagnostic context such as database errors and Query Insights slowest queries, and alert and incident events mark threshold breaches and platform outages on charts. When these signals are correlated, unusual behavior can be linked to a resource problem.
The Health and troubleshooting page in Cloud Hub merges metrics, logs, and events for a selected time range, defaulting to the last hour. Selecting a product, service, or workload shows key health charts with annotated events plus links to alerts, incidents, logs, and dashboards. Cloud Monitoring charts use three event types: Cloud Monitoring alert events fired by your own policies, Service Health events for Google outages, and product-specific events from individual products. Charts show recommended events by default with the Annotations selector controlling display.
| View | Scope | What the list shows |
|---|---|---|
| Project view | Individual project | Open alerts and Service Health events per active product with health charts below |
| Application view | App Hub application | Open alerts and Service Health events per service or workload with charts below |
Open alerts come from your own alerting policies, while Google Cloud incidents come from Service Health outages. Cost recommendations need the Recommender API and Recommender Viewer role, while health checks need the Service Health API and Service Health Viewer role.
Insights describe current state while recommendations suggest changes. Performance prompts ask for current CPU, high-latency or slowest queries, highest-utilization VMs, or Dataflow backlog, reflecting live telemetry. Cost prompts ask for savings, idle VMs, BigQuery partitioning, or near-limit quotas, where idle means low use with continued cost and near-limit means risk of throttling. Investigations provide deeper analysis with Issue including start and stop time, ranked Findings such as misconfiguration or resource spikes, and Hypotheses for next steps. Creating an investigation requires asking in chat, clicking Create investigation, reviewing details, and clicking Create, with Premium Support and Investigation Creator role required. All AI output must be validated against monitoring data, documentation, and limited-scope testing before broad production change.
Exam tip: Open alerts come from your own Cloud Monitoring alerting policies, while Google Cloud incidents come from Service Health and describe Google-side outages.
Continue with this study guide: Using Gemini Cloud Assist for Cloud Monitoring
Active Assist (opens in a new tab) is a portfolio of intelligent tools that analyzes Google Cloud usage and suggests actions to reduce cost, improve performance, and support sustainability. The Recommender API analyzes usage and configuration and produces an insight describing what was observed plus a recommendation describing what to do. You review results in the Recommendation Hub central view or by asking Gemini Cloud Assist in natural language.
Insight types point to underused capacity, risky configuration, and efficiency opportunities. Cost and efficiency insights flag idle VMs and BigQuery datasets that should be partitioned or clustered, while reliability insights flag quotas near limit and unhealthy cluster configurations. Common requests ask for cost reduction savings, idle VMs to stop or resize, datasets to partition, and quotas almost hitting limits. Access needs the Recommender API (recommender.googleapis.com) plus Recommender Viewer role, while cost anomaly analysis needs the App Optimize API plus Cloud Hub Operator role. Gemini generally does not return exact billing amounts, so actual bills remain in the FinOps hub.
| Insight | What it flags | Prioritize when |
|---|---|---|
| Quota near limit | Usage close to project quota | Growth or peak traffic could soon be blocked |
| Cluster reliability | Risky or unhealthy configuration | Availability or stability is affected |
| BigQuery partitioning and clustering | Large tables scanned inefficiently | Query speed and scan cost matter |
| Idle VMs and cost reduction | Low-utilization resources with savings | You want quick savings with low risk |
Apply outage-preventing fixes first, then performance fixes, then cost-only savings. Product advisors include the IAM Recommender for least privilege with subtype REMOVE_ROLE, plus compute, BigQuery, and quota advisors whose data can be exported to BigQuery and visualized in Looker.
Automation and governance apply recommendations consistently across projects. Cloud Monitoring utilization data flows into rightsizing decisions for managed instance groups, while the FinOps hub uses AI to recommend savings with role-based access control. Automated notifications warn about cost anomalies, budget thresholds, and quota percentages, and built-in features adjust capacity automatically such as autoscaling for Compute Engine and Google Kubernetes Engine (GKE) and Object Lifecycle Management and Autoclass for Cloud Storage. Organization policies limit allowed locations and products, detailed budgets set thresholds per project and workload, and quotas block excess provisioning at project, service-specific, and resource-type levels with alerts at a percentage of maximum.
Exam tip: Active Assist provides recommendations such as rightsizing, while organization policies, quotas, and budgets enforce limits on what can be provisioned.
Continue with this study guide: Using Active Assist to optimize resource utilization
custom.googleapis.com/, workload.googleapis.com/, and external.googleapis.com/, while log-based counter metrics count matching entries and distribution metrics record count, mean, and histogram buckets.An alerting policy in Cloud Monitoring watches time-series data and compares it to a threshold for a set duration, then sends a notification through a notification channel when the condition holds. The policy describes what to watch and who to notify including the data source, threshold and aggregation settings, and when the data meets the condition Monitoring creates an alert as a record of what was monitored and when that flows to a notification channel delivering by email, Slack or another destination.
Counter log-based metrics count the number of matching log entries per interval for frequency of errors, warnings or operations by label, while distribution log-based metrics record count, mean, sum of squared deviations and histogram bucket counts for extracted numbers for spread, average or trends for latencies or value ranges. Log-based metrics collect data only from entries received after the metric is created and never backfill history.
Use PodMonitoring in Google Cloud Managed Service for Prometheus when you need to scrape matching pods in a single namespace, and use ClusterPodMonitoring when you need to scrape matching pods across all namespaces such as for shared services. Each collector scrapes only pods on its own node, with PodMonitoring discovering pods in one namespace and ClusterPodMonitoring discovering matching pods across all namespaces.
LogEntry object that records a single event from a monitored resource. A log is a collection of log entries, and each log entry applies to one monitored resource ty…Last updated