Cloud Computing Tutorial · Integration and Operations · Lesson 20 of 24
Monitoring and Logging in the Cloud
CloudWatch, Azure Monitor and Google Cloud Observability: metrics, logs, alarms, dashboards and tracing for cloud workloads.
Native tools
| Need | AWS | Azure | Google Cloud |
|---|---|---|---|
| Metrics and alarms | CloudWatch Metrics and Alarms | Azure Monitor metrics and alerts | Cloud Monitoring |
| Logs | CloudWatch Logs (Logs Insights queries) | Log Analytics (KQL) | Cloud Logging (Log Analytics) |
| Traces | X-Ray / CloudWatch Application Signals | Application Insights | Cloud Trace |
| Audit (who changed what) | CloudTrail | Activity Log | Cloud Audit Logs |
Many teams send everything through OpenTelemetry so they can use the native tools or a third-party platform without rewriting instrumentation.
Practical defaults
- Alarms on user-facing symptoms (error rate, latency) per service, plus a few predictive ones (disk, quotas, certificate expiry).
- Log retention set explicitly: CloudWatch log groups keep data forever by default, and ingestion and storage are billed.
- Structured JSON logs with request IDs, and sampling for very high-volume debug logs.
INGEST_PER_GB = 0.50 # example log ingestion price, USD
STORE_PER_GB_MONTH = 0.03 # example log storage price
def yearly_cost(gb_per_day, retention_days):
ingest = gb_per_day * 365 * INGEST_PER_GB
stored_gb = gb_per_day * min(retention_days, 365)
return ingest + stored_gb * STORE_PER_GB_MONTH * 12
for label, gb, days in [("debug logs, keep forever", 50, 365), ("info logs, 30 days", 8, 30), ("info + sampled debug", 10, 30)]:
print(f"{label:26} ${yearly_cost(gb, days):9,.0f} per year")
Output
debug logs, keep forever $ 15,695 per year info logs, 30 days $ 1,546 per year info + sampled debug $ 1,933 per year
Test yourself
What's the default retention of a new CloudWatch Logs log group?
1 day30 days1 yearNever expire
Show answer
Answer: Never expire
Set retention explicitly, or logs accumulate (and cost) forever.