October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

How to Set Log Retention and Sampling to Control SaaS Logging Costs

A practical guide to reducing SaaS logging costs with upstream filters, careful sampling, provider-specific retention settings, and delivery-pipeline safeguards.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Control SaaS logging costs by reducing low-value logs before they reach billable storage, setting retention for each log bucket or group, and verifying that essential events still reach the people and systems that need them. The controls differ by provider: Google Cloud Logging supports excluding a percentage of matching entries through sink exclusions, while the cited AWS guidance recommends filtering before ingestion without documenting an equivalent proportional log-sampling control.

Start by finding costly, low-value logs

Inventory the sources that feed your logging service, then identify the busiest log groups, buckets, and event types. Look for repetitive health checks, routine success events, or verbose debug output that adds little value during troubleshooting. Volume alone is not a reason to discard an event: decide first which records are needed for incident response, security investigations, audits, and operational support.

As an Amazon Associate I earn from qualifying purchases.

Write down the purpose of each source and the destinations it feeds. A pipeline may send the same records to more than one destination, and each destination can have separate billing and retention behavior. Establish what must remain available and for how long before changing filters or expiry settings; the sources do not establish a universal retention duration or sampling percentage.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Filter before storage, and sample only where supported

Filtering upstream can prevent low-value entries from reaching billable storage. The exact control depends on the service. Google Cloud recommends sink exclusion filters; AWS recommends filtering logs before ingestion. Do not assume a sampling feature documented for one provider exists in another.

Google Cloud Logging: use sink exclusions

Google Cloud sink exclusions can omit all entries matching a filter or only a percentage of them. Excluded entries are not streamed to the affected log buckets and do not count against the stated storage allotment. The Google Cloud guidance on optimizing logs recommends exclusions for low-value entries.

The exclusions API reference demonstrates the sample function with sample(insertId, 0.99) to exclude 99% of matching low-severity Cloud Storage bucket entries. That is an example, not a generally safe setting. Before applying a percentage exclusion, confirm the filter matches only the intended events and that the remaining sample is adequate for diagnosis. Keep critical security, audit, and incident-response events out of the exclusion rule. The Required sink cannot be modified or used to exclude logs.

Rank #2
Apera Instruments PCO60-Z Bluetooth pH/Conductivity/ORP/Redox/TDS/Salinity/Resistivity Smart Multi-Parameter Meter Tester Kit Powered by ZenTest Mobile App with Cloud-Based Datalogger
  • Smart Integration –– Easily connect the tester to your smartphone, tablet, or MacBook via Bluetooth with the ZenTest app for real-time measurement control, calibration, and advanced data management within a 30 ft range.
  • Precision Measurement –– Featuring a double-junction pH/conductivity combo sensor and a separate ORP sensor for high accuracy and durability, ensuring precise measurements across pH, conductivity/TDS/salinity/resistivity, and ORP (redox).
  • Cloud-Based Data Logging –– Securely log, manage, and share your test data with our cloud-based data management system, allowing for easy access and ensuring your data is always protected against loss.
  • Hybrid Functionality –– Designed for versatility, our tester works as a standalone classic tester when not connected to a smart device, offering uninterrupted testing capabilities.
  • Effortless Usability –– Tailored for professionals seeking efficiency and reliability, our tester combines easy-to-use features and fully customizable settings with robust performance, making it ideal for lab, field, or any testing environment.

Amazon CloudWatch Logs: filter before ingestion

AWS guidance recommends filtering logs before ingestion and setting retention on log groups to manage costs. Its documented 30-day retention command is an example value, not a recommendation for every workload. The cited guidance does not establish a proportional log-sampling feature equivalent to Google Cloud’s exclusion example; use only controls documented for your AWS pipeline.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set retention for each bucket or log group

Retention determines how long stored logs remain available under a service’s policy. Set it per bucket or log group based on operational, security, audit, and organizational requirements. Document why the period fits the data’s purpose, and verify the configuration on the actual resource: defaults and available settings vary by provider, bucket, and scope.

Google Cloud Logging retention

Google Cloud Logging has bucket-specific defaults and configurable retention periods. The quotas and limits documentation says project-level _Default and user-defined buckets can be configured from 1 to 3650 days; other bucket and resource-scope combinations differ. For folder- or organization-level entries retained beyond 30 days, that documentation says to route them to a project log bucket. Check the current documentation and the configuration of the specific bucket before relying on a duration.

Amazon CloudWatch Logs retention

CloudWatch Logs retains data indefinitely by default until a retention policy is set on the log group. AWS marks events for deletion after they reach the configured retention point. Deletion typically takes up to 72 hours after that point and can rarely take longer, so a retention setting should not be treated as an exact-time deletion guarantee. See AWS’s log group and stream documentation.

Understand the cost and expiry trade-offs

Charges depend on the provider and the path logs take through the service. Compare ingestion, storage, extended retention, queries, alerts, exports, and delivery to other destinations—not just the headline ingestion rate. The published Google Cloud rates below are provider-specific figures from its pricing page, not general SaaS market prices; rates and effective dates are volatile, so check the live Google Cloud Logging pricing page before making a budget decision.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Google Cloud Logging charge Published figure Qualification
Logging storage other than vended network logs $0.50/GiB; first 50 GiB per project per month free Effective date listed as July 1, 2018; verify current pricing.
Vended network logs $0.25/GiB Effective date listed as October 1, 2024; verify current pricing.
Logs retained beyond 30 days $0.01/GiB/month Effective date listed as January 1, 2022; verify current pricing.

Shortening Google Cloud bucket retention starts a seven-day grace period, according to the pricing documentation. During that period, expired logs cannot be queried or viewed; extending retention within the grace period can restore access. Treat a shorter retention setting as an availability change as well as a cost control.

Choose CloudWatch Logs classes deliberately

CloudWatch Logs Infrequent Access has lower ingestion pricing than Standard but a reduced feature set; storage and Logs Insights charges are the same between the two classes. A log group’s class cannot be changed after creation, so review query, alerting, and operational requirements before selecting it. Delivery is a separate class for delivering Lambda logs to S3 or Firehose; it has a fixed two-day retention and does not support Logs Insights. Consult the AWS log classes documentation for the current feature distinctions and AWS CloudWatch pricing for current prices.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Protect log delivery pipelines from recursion

CloudWatch Logs subscription filters can create an infinite delivery loop if a workflow includes the log groups that record the workflow itself. AWS warns that this can sharply increase ingestion billing in both CloudWatch Logs and the destination. Exclude groups participating in the delivery pipeline from its subscription filters, as described in AWS’s recursion-prevention documentation.

Roll out changes and verify the result

  1. Inventory: list log sources, high-volume groups or event types, destinations, and their current retention policies.
  2. Set requirements: identify events that must remain available for troubleshooting, incident response, security, or audit, and document the retention rationale for each relevant source.
  3. Apply a narrow filter: exclude only identified low-value events using the provider’s documented controls. For percentage exclusions, validate filter semantics and confirm critical events are not affected.
  4. Configure retention: set the intended period on each applicable bucket or log group, accounting for provider-specific defaults and expiry behavior.
  5. Check tiers and pipelines: compare ingestion and storage charges alongside query, alerting, and delivery needs; check for recursive subscriptions and destination costs.
  6. Measure and inspect: monitor log volume and spend after the changes, then verify that required events still arrive and can be queried where expected.

There is no universal sampling rate or standardized validation procedure established by the cited provider documentation. Set exclusions according to the value and risk of each event stream, then verify the result in your own environment.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.