Free tech learning for everyone, from basics to pro

Cloud MonitoringCloud SecurityIntermediate

A cloud logging strategy: what to log, central storage, retention and protection

In short: A good logging strategy decides in advance what to collect, where it goes and how long it is kept. Prioritise control plane audit logs, identity sign-ins, network flows and key workload logs, send them to a separate protected account, use tiered retention and make the archive tamper-resistant.

Why plan logging

When an incident happens, the first question is usually "what do the logs show?" Too often the answer is that the relevant log was never enabled, was kept for only a week or was deleted by the attacker. In the cloud many important logs are off by default or kept briefly unless you configure them. A logging strategy fixes this before you need it, and supports compliance requirements under frameworks such as ISO/IEC 27001:2022 and PCI DSS.

What to log first

PrioritySourceExamples
1Control plane audit logs (who changed what)AWS CloudTrail, Azure Activity Log, Google Cloud Audit Logs
1Identity and sign-in logsEntra ID sign-in and audit logs, IAM Identity Center, Okta
2Data access logs for sensitive storesS3 data events, Key Vault and KMS access, database audit
2Network flow logsVPC Flow Logs, VNet flow logs, firewall and WAF logs
3Workload logsKubernetes audit, OS security logs, application logs
3Security service findingsGuardDuty, Defender for Cloud, Security Command Center

Each useful log entry should answer who, what, when, where (source IP, region, resource) and the outcome. Keep clocks synchronised; cloud services use UTC, so store and display times in UTC to avoid confusion during investigations.

Do not log secrets, full card numbers or unnecessary personal data. Logs are often read by many people and kept for years, and they fall under data protection law such as the UK GDPR.

Centralise and protect

Central logging pipelineSourcescloud, OS,appsCollectagents,exportsCentral storeseparateaccountAnalyseSIEM, queriesRetainhot thenarchive
Figure 1. Logs flow from many sources into one protected store, where they are analysed and kept for a defined period.

Send logs from all accounts or subscriptions to a dedicated log archive account or workspace that workload teams cannot administer. Organisation-wide features make this easier, such as an AWS Organizations trail or Azure diagnostic settings applied by policy. Then:

  • Make the archive immutable using write-once storage such as S3 Object Lock or Azure immutable blob storage.
  • Restrict who can stop logging, change retention or delete logs, and alert on any attempt.
  • Encrypt logs, ideally with a customer-managed key in the security account.
  • Enable integrity validation where offered, such as CloudTrail log file validation.

Tip: attackers often try to disable logging early. An alert on "trail stopped" or "diagnostic setting deleted" is one of the most valuable detections you can build.

Retention and cost

Log tiers by ageHotdays to weeks, fast searchWarmweeks to months, slowerCold archivemonths to years, cheap
Figure 2. Tiered retention keeps recent logs searchable and older logs affordable.

Set retention from three inputs: legal and regulatory requirements, how long attacks often go unnoticed (which can be months), and budget. A common pattern is 30 to 90 days in a searchable SIEM tier, then a year or more in cheap archive storage that you can restore or query when needed. Reduce cost by filtering noisy, low-value events before ingestion rather than by cutting security-critical sources.

  1. List required sources per account and enable them by policy.
  2. Route everything to the central log account.
  3. Define retention per source and apply lifecycle rules.
  4. Lock down and monitor the log store.
  5. Test: can you answer "who deleted this resource last month?" within minutes?

Practice

Why should logs go to a separate account that workload admins cannot control?
So an attacker or insider who compromises a workload account cannot delete or alter the evidence of what they did.
Name two log sources you would enable first in any cloud account.
Control plane audit logs (such as CloudTrail or Activity Log) and identity sign-in and audit logs.
How can you cut logging costs without losing key evidence?
Use tiered retention with cheap archives and filter noisy low-value events, while keeping audit, identity and security logs in full.

Key takeaways

  • Plan logging before an incident; many cloud logs are off by default.
  • Start with audit, identity, data access and network flow logs.
  • Centralise logs in a separate, locked-down account.
  • Use immutable storage and alert on attempts to stop logging.
  • Set tiered retention from legal needs, dwell time and budget.
Tracks your learning on this device only. See your progress on the learning paths.

About the author

Mohamed Fayas

Founder of FM TecHub. CCNA certified, with a BTEC HND in Network Engineering, and BEng (Hons) in Computer Networking and Cloud Security. He writes practical, plain-English guides on networking, security and cloud.

More about the author

Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.

Stay up to date by email

New notes, tools and security news from FM TecHub, explained simply. Free.

We only use your email to send these updates. See our privacy policy.