ThisCalculator

Everyday

Cheap Hosted Logging for Postgres SaaS: 4 Cost Clues

Updated · Standard formula, shown below

The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.

This article helps you estimate the real cost of hosted logging for a Postgres-based SaaS API by focusing on four clues that matter most: ingestion volume, retention period, query frequency, and egress fees. You enter your expected log volume, retention needs, and search patterns, and you get a cost framework to compare providers. The goal is to avoid the common trap of choosing a provider based on per-GB price alone, which often hides the true total cost.

Formula

The formula estimates monthly cost (C) as:

C = (V × 30 × R × 0.5) + (Q × 1000 × 0.0007 × 30) + (E × 0.09)

Where:

  • V = daily log volume in GB (what you send per day)
  • R = retention period in days (how long logs are kept)
  • Q = thousands of searches per day (API calls to the logging service)
  • E = monthly data egress in GB (logs downloaded or streamed out)
  • 0.5 = average ingestion cost per GB (USD, varies by provider)
  • 0.02 = average storage cost per GB-month (USD, varies)
  • 0.0007 = average cost per search (USD, varies by provider)
  • 0.09 = average egress cost per GB (USD, varies)

These are representative industry averages as of 2024; actual prices differ. Use them as a starting point for comparison, not as a quote.

Worked Example

Using the defaults from the calculator: V=10 GB/day, R=30 days, Q=5 thousand searches/day, E=100 GB/month.

Step 1: Ingestion cost = 10 × 30 × 0.5 = $150

Step 2: Storage cost = 10 × 30 × 30 × 0.02 = $180 (note: 10 GB/day × 30 days = 300 GB stored, at $0.02/GB-month)

Step 3: Query cost = 5 × 1000 × 0.0007 × 30 = $105

Step 4: Egress cost = 100 × 0.09 = $9

Step 5: Total = 150 + 180 + 105 + 9 = $444/month

The calculator rounds to $444, matching the formula. This example shows that storage and query costs can exceed ingestion, which is why per-GB pricing alone is misleading.

Why Postgres SaaS Logging Is Different

Postgres-based SaaS APIs generate logs from two sources: application logs (API requests, errors, business events) and database logs (slow queries, connection attempts, deadlocks). Most hosted logging services treat both the same, but database logs tend to be more verbose and repetitive. A single misconfigured query can generate megabytes of repeated log lines. For a SaaS, log volume often scales with API traffic, so it’s not static—it grows with your user base. This means the cost is not just a function of your current volume but of your growth rate. Many providers offer free tiers, but they are typically limited to 1-5 GB/day and short retention (7-14 days), which is insufficient for production debugging.

The Four Cost Clues

The four clues that matter most when estimating hosted logging costs are:

  1. Ingestion volume: The amount of log data you send per day, measured in GB. This is the most obvious cost, but it’s only the beginning.
  2. Retention period: How long you need to keep logs. Longer retention multiplies storage costs linearly. For compliance, you might need 90 days or more, which can dominate the bill.
  3. Query frequency: How often you search logs. Each search can cost money, especially on services that charge per query or per GB scanned. A team that debugs frequently can rack up significant costs.
  4. Egress fees: The cost to download or stream logs out of the service. If you export logs to your own storage or run analytics, egress can add up, especially with high-volume services.

Ignoring any of these can lead to a surprise bill. For example, a provider may advertise $0.50/GB ingestion but charge $0.10 per search, making heavy debugging expensive.

How to Choose a Provider

When comparing hosted logging providers, don’t just look at the per-GB price. Consider your specific usage pattern:

  • Estimate your daily log volume realistically—look at current logs, not just API requests. Include database logs if you plan to send them.
  • Decide on retention based on compliance needs and debugging habits. 30 days is common, but some teams need 90.
  • Count how many times per day you or your team search logs. This is often underestimated.
  • Check egress fees—some providers include egress, others charge per GB.

Also consider the cost of the plan itself. Many providers have a base monthly fee that includes a certain volume, then charge overage. Calculate your expected usage and compare total monthly cost, not just the base fee.

Common Problems and Misconceptions

A common misconception is that you need to send all logs to the hosted service. In reality, you can filter logs client-side to reduce volume. For example, you might only send error logs and a sample of info logs. Another issue is that log volume is spiky—a traffic spike can triple your daily volume, pushing you into overage. Most providers charge overage at a higher rate, so it’s wise to build in a buffer. Also, many teams forget to account for the cost of indexing—some providers charge extra for full-text search on certain fields. Finally, beware of the “unlimited” retention plans that seem cheap but have hidden limits on query speed or concurrent users.

Alternatives to Hosted Logging

If hosted logging becomes too expensive, consider self-hosting an open-source solution like the ELK stack (Elasticsearch, Logstash, Kibana) or Grafana Loki. Self-hosting gives you control over costs, but you must pay for your own infrastructure and maintenance. For small teams, a simple solution like writing logs to a table in Postgres itself can work for low volumes, but it degrades performance. Another option is to use a cloud provider’s native logging service (e.g., AWS CloudWatch, GCP Cloud Logging) which may be cheaper if you are already on that cloud. However, these services often have their own quirks and egress fees.

Safety and Accuracy Notes

When estimating costs, always use your own data. The averages in the calculator are illustrative, not guarantees. Check the provider’s pricing page for current rates. Also, be aware that some providers charge for log ingestion based on the number of events, not just GB. If your logs are small but numerous, event-based pricing could be cheaper or more expensive. Always read the fine print about data retention—some providers delete logs after a period even if you pay for longer, unless you specifically archive them. Finally, consider the cost of not having logs: downtime due to undiagnosed issues can cost far more than a logging bill.

Frequently Asked Questions

What is the cheapest hosted logging service?

There is no single cheapest service—it depends on your volume and usage. For very low volume (under 1 GB/day), some providers offer free tiers, but they may have limited retention. For higher volume, open-source self-hosting is often cheaper if you have the expertise. Compare total cost using the formula above.

How do I reduce log ingestion cost?

Filter logs before sending. Send only error and warning logs, and sample info logs. Also, avoid logging sensitive data that you don’t need. Use structured logging to make filtering easier. Consider aggregating logs in batches to reduce the number of requests.

Is it cheaper to self-host logging?

For large volumes, self-hosting can be cheaper, but you must account for server costs, storage, and maintenance time. For small teams, the time spent managing a logging cluster often outweighs the savings. Start with hosted and migrate if costs grow.

How long should I keep logs?

It depends on your needs. For debugging, 30 days is often enough. For compliance, you may need 90 days or more. Check your industry regulations. Longer retention increases storage costs linearly, so only keep what you need.

What are egress fees and how do I avoid them?

Egress fees are charges for data leaving the provider’s network. To avoid them, use the provider’s built-in query interface instead of exporting logs. If you must export, consider using a provider that includes egress in its plan, or use a cloud provider with lower egress rates.

Can I use the calculator for my specific provider?

Yes, adjust the average costs in the formula to match your provider’s pricing. The calculator uses averages; replace 0.5, 0.02, 0.0007, and 0.09 with your provider’s rates for a more accurate estimate.

Related

Formula used
in v | Daily log volume | GB/day | 10 | 0
in r | Retention period | days | 30 | 1
in q | Searches per day | thousands | 5 | 0
in e | Data egress per month | GB | 100 | 0
out c | Estimated monthly cost | USD | (v * 30 * r * 0.5) + (q * 1000 * 0.0007 * 30) + (e * 0.09) | 0
out i | Ingestion cost | USD | v * 30 * 0.5 | 0
out s | Storage cost | USD | v * 30 * r * 0.02 | 0
out qc | Query cost | USD | q * 1000 * 0.0007 * 30 | 0

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.