At some point in the lifecycle of any application, log management becomes essential. Ideally, teams should start monitoring logs as early as possible, but in practice, logs often get deprioritized until a real problem arises. While cloud providers like AWS CloudWatch or Google Cloud Logging (Cloud Run) offer built-in solutions, they are not always the most convenient or cost-efficient tools for deeper log analysis.
Another challenge is sharing access. If you want another team—such as support, security, or compliance—to review logs, are you really going to grant them AWS or GCP access? That introduces unnecessary risk, since cloud environments contain sensitive resources beyond just logs.
So, the question becomes: how do we handle logs efficiently, securely, and cost-effectively?
The Cost Challenge of Logs
Most log management platforms (e.g., Datadog, Splunk, New Relic, Elastic Cloud) charge based on data volume ingested and retention period. This means costs scale directly with:
- Log volume per month (e.g., 500GB vs 2TB).
- Retention requirements (e.g., 7 days vs 90 days).
For example, retaining 1TB of searchable logs for 90 days can quickly rack up thousands of dollars in costs. If you don’t plan ahead, you might be paying for hot storage on data you’ll rarely query.
Step 1: Understand Your Log Requirements
Before designing your logging pipeline, answer these key questions:
1 What is our log volume?
- Example: 2TB/month.
- Collect actual metrics from CloudWatch, Cloud Logging, or your app servers
2 How long do we need searchable logs?
Example: 60 days retention.
Sometimes compliance requirements mandate 90–180 days (or more).
3 Where are our logs generated and stored today?
Example: logs stored in AWS S3.
S3 is excellent as a cold storage layer: inexpensive, durable, and compression-friendly.
Once you know volume + retention + source, you can make better architectural decisions.
Step 2: Separate Hot and Cold Storage
Not all logs need to be instantly searchable. To save costs, split logs into:
-
Hot storage:
- Short retention (e.g., 7–14 days).
- Indexed and searchable in tools like OpenSearch, Elasticsearch, or Datadog.
- Used for active debugging, monitoring, and incident response.
-
Cold storage:
- Long retention (e.g., 60–180 days).
- Stored cheaply in S3, Glacier, or equivalent.
- Only re-indexed when needed (via scripts or batch jobs).
This layered approach drastically reduces costs while still keeping historical data available.
Step 3: Indexing and Visualization
S3 alone is not searchable—you need a system that can index logs and provide visualization. Options include:
-
Open-source:
-
Commercial SaaS (faster to set up, but pricier):
- Datadog Logs
- New Relic
- Splunk
Each comes with trade-offs in scalability, query performance, and price. OpenSearch and Loki are great for cost-conscious teams, while Datadog and Splunk offer convenience at a premium.
Step 4: Log Shipping (Data Ingestion Layer)
To make logs available in your chosen tool, you need to ship logs from the source to the destination. Options include:
-
AWS-native:
- Amazon Kinesis Data Firehose – reliable, scalable, but sometimes overkill.
-
Lightweight log shippers:
- Fluent Bit – very fast, low resource usage, widely adopted.
- Vector (by Datadog) – simple config, good performance.
- Filebeat – part of the Elastic stack.
These agents can pull logs from CloudWatch, Cloud Logging, or directly from application containers, and push them into OpenSearch, Elasticsearch, or a SaaS platform.
Step 5: Rehydrating Logs from Cold Storage
When older logs are needed (for audits, investigations, or post-mortems), you don’t want them indexed 24/7. Instead:
- Pull compressed logs from S3 (or Glacier).
- Run a reindexing script that ingests them back into OpenSearch or Elasticsearch temporarily.
- Once the investigation is done, drop them from hot storage again.
This “rehydration on demand” model ensures you balance cost efficiency with data availability.
Example Architecture
Here’s how the pieces fit together:
- Applications & Services generate logs.
- Fluent Bit / Vector agents collect and forward logs.
- Logs flow into OpenSearch (hot storage) with a retention of ~7 days.
- In parallel, logs are stored in S3 (cold storage) with a retention of 60–180 days.
- If old logs are needed, a rehydration script reindexes data from S3 into OpenSearch.
- Teams access logs securely via OpenSearch Dashboards / Kibana, without needing AWS or GCP console access.
Key Takeaways
- Don’t pay for hot storage on all logs—split between hot and cold.
- Use lightweight shippers like Fluent Bit or Vector to control ingestion.
- Leverage S3 for retention—cheap, reliable, and compression-friendly.
- Provide access through log platforms, not cloud consoles—safer and easier for collaboration.
By structuring your logging pipeline this way, you’ll achieve a balance between cost, performance, and security, while keeping your team efficient when troubleshooting issues.
Top comments (0)