Intrigued by the art of cloud architecture? Discover how to design, develop, and manage robust, secure, scalable, and dynamic solutions on Google Cloud as you prepare for the Professional Cloud Architect exam!
Prepare and test your skills
Prepare and test your skills
Cloud Logging and Cloud Monitoring are the core services used to observe the health and performance of systems in Google Cloud. Telemetry data, such as system logs and performance metrics, flows from virtual machines and container clusters to these centralized services. To collect this data from compute instances, you must install the Ops Agent, which continuously runs inside the operating system and pushes system logs and performance metrics to GCP. Once ingested, this data is organized by monitored resource types, making it easy to query, visualize, and analyze.
Within Cloud Logging, the Log Router acts as a control post that evaluates every incoming log entry against configured exclusion and inclusion filters. The router sends matching logs to defined destinations, known as sinks, including Cloud Storage for long-term archiving, BigQuery for deep SQL analysis, or Pub/Sub for real-time streaming to third-party tools. This routing decision happens immediately upon ingestion, ensuring that logs are stored efficiently according to compliance and analytical needs. Choosing the right sink depends on your lifecycle requirements, as storing logs in BigQuery is ideal for immediate analytics, while Cloud Storage offers the cheapest long-term retention.
A diagram showing how the Ops Agent sends logs to Cloud Logging, where the Log Router evaluates inclusion and exclusion filters to route logs to sinks like Cloud Storage, BigQuery, and Pub/Sub.
In Cloud Monitoring, a metric scope defines the boundary of GCP projects whose performance data you want to view together. This allows administrators to monitor multiple projects from a single host project dashboard, simplifying oversight across large environments. Dashboards display these metrics in real-time charts, helping operations teams identify trends and detect anomalies before they impact users.
Understanding application performance requires looking deeper than basic virtual machine metrics, which is where Cloud Trace and Cloud Profiler fit in. Cloud Trace tracks how requests move through distributed systems, collecting latency data as a request flows across microservices and database boundaries. Each request is broken down into spans, which show the exact time spent in each service during the execution path. This visibility allows developers to pinpoint exactly which service or database query is causing a delay in the user experience.
While trace data shows how requests flow, Cloud Profiler analyzes the execution of the code itself to optimize resource usage. It continuously gathers CPU and memory consumption data from the running application with minimal performance overhead. Developers use this profiling data to identify resource-heavy functions, which helps reduce compute costs and improve application responsiveness. This profiling runs continuously in the background, allowing teams to benchmark code changes under real-world production loads.
An effective monitoring setup requires automated alerting to notify engineers when system health degrades. In Cloud Monitoring, you create alerting policies that define specific conditions, such as CPU utilization exceeding a set threshold or an increase in HTTP error rates. These policies can evaluate metric thresholds over time, preventing temporary spikes from triggering false alarms. You can also configure log-based alerts to notify teams immediately when specific error messages appear in the system logs.
When an alerting policy condition is met, an incident is automatically created and enters an active state. The system immediately forwards the alert to designated notification channels, which can include email, Slack, or incident management platforms like PagerDuty. An engineer can mark the incident as acknowledged while they investigate and work on a fix. Once the underlying system metric returns to a safe level, the incident moves to a resolved state, and the alerting cycle concludes.
The Ops Agent is installed on compute instances and continuously runs inside the operating system to collect and push system logs and performance metrics to GCP's centralized observability services.
The Log Router can send logs to Cloud Storage for long-term archiving, BigQuery for deep SQL analysis, or Pub/Sub for real-time streaming to third-party tools.
Cloud Trace tracks how requests move through distributed systems, collecting latency data as requests flow across microservices and database boundaries, broken down into spans showing time spent in each service.
Cloud Profiler continuously gathers CPU and memory consumption data from the running application with minimal performance overhead, helping developers identify resource-heavy functions.