How to Build a Production Log Stack for Under $50/Month
A complete guide to setting up production-grade logging for startups and small teams. Get 90% of enterprise features at 10% of the cost.
Enterprise logging platforms want $500-5000/month. But most startups and small teams don't need enterprise features - they need reliable logging that helps them debug production issues. Here's how to build a production-grade log stack for under $50/month.
What You Get for $50/Month
Features included:
✓ Centralized log collection
✓ Fast full-text search
✓ 30-day retention
✓ Basic alerting
✓ Dashboard visualization
✓ 10-50GB logs/month capacity
What you won't get:
✗ ML-powered anomaly detection
✗ Complex APM features
✗ Enterprise compliance certifications
✗ 24/7 vendor support
Option 1: Managed Service ($49/month)
The easiest path - use a managed service designed for small teams.
401 Clicks Setup
# 1. Sign up at 401clicks.com ($49/month for startups)
# 2. Install the Laravel package
composer require 401clicks/laravel-logger
# 3. Configure
# .env
FOUROHONE_CLICKS_API_KEY=your_key_here
LOG_CHANNEL=401clicks
# 4. That's it - logs are now shipping
What You Get
- 15-day retention (30 days on Scale plan)
- Fast search across all logs
- Slack/email alerts
- No infrastructure to manage
Option 2: Self-Hosted Minimal ($20-30/month)
If you want more control and have basic DevOps skills.
Architecture
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Application │────▶│ Vector │────▶│ Loki │
│ │ │ (shipper) │ │ + Grafana │
└─────────────┘ └─────────────┘ └─────────────┘
│
┌──────┴──────┐
│ $5 VPS │
│ (Hetzner) │
└─────────────┘
Setup Steps
# 1. Provision a small VPS ($5-10/month)
# Hetzner CX11 or DigitalOcean Basic Droplet
# 2. Install Loki + Grafana via Docker
# docker-compose.yml
version: '3'
services:
loki:
image: grafana/loki:2.9.0
ports:
- "3100:3100"
volumes:
- ./loki-data:/loki
command: -config.file=/etc/loki/local-config.yaml
grafana:
image: grafana/grafana:latest
ports:
- "3000:3000"
environment:
- GF_AUTH_ANONYMOUS_ENABLED=true
volumes:
- ./grafana-data:/var/lib/grafana
# 3. Configure your app to ship logs
# Using Vector or Promtail
Cost Breakdown
Hetzner CX21 (2 vCPU, 4GB RAM): €5.83/month
Block storage (50GB): €2.50/month
Total: ~$10/month
Scales to: ~20GB logs/day with aggressive retention
Option 3: Hybrid Approach ($30-40/month)
Ship critical logs to a managed service, everything else to self-hosted.
# Vector configuration for hybrid routing
sources:
app_logs:
type: file
include: ["/var/log/app/*.log"]
transforms:
route_logs:
type: route
inputs: [app_logs]
route:
critical: '.level == "error" or .level == "critical"'
normal: '.level != "error" and .level != "critical"'
sinks:
# Errors to managed service (guaranteed delivery)
401clicks:
type: http
inputs: [route_logs.critical]
uri: https://ingest.401clicks.com/logs
auth:
strategy: bearer
token: ${API_KEY}
# Normal logs to self-hosted (cost savings)
loki:
type: loki
inputs: [route_logs.normal]
endpoint: http://your-loki:3100
Essential Features to Set Up
1. Structured Logging
<?php
// Good: Structured
Log::error('Payment failed', [
'order_id' => $order->id,
'error_code' => $e->getCode(),
'customer_id' => $customer->id,
]);
// Bad: Unstructured
Log::error("Payment failed for order {$order->id}");
2. Request Context
<?php
// Add request context to all logs
Log::shareContext([
'request_id' => request()->header('X-Request-ID', Str::uuid()),
'user_id' => auth()->id(),
'url' => request()->fullUrl(),
]);
3. Error Alerting
# Basic alert rule (Grafana/401 Clicks)
Alert: Production Errors
Query: level="error" | count() > 10
Window: 5 minutes
Action: Slack notification to #alerts
4. Useful Dashboards
Essential panels:
- Error count over time
- Errors by type
- Request volume
- Response time percentiles
- Top error messages
Scaling Beyond $50
When you outgrow the $50 setup:
Growth triggers:
- Log volume > 50GB/month
- Team size > 5 engineers
- Need compliance features
- Require better search performance
Upgrade path:
$50 → $150: More retention, volume
$150 → $500: Add APM, better alerting
$500+: Enterprise features when needed
Common Mistakes to Avoid
1. Logging Too Much
# Bad: Log every request detail
Log::debug('Processing request', $request->all());
# Good: Log what you'll actually search for
Log::info('Order processed', [
'order_id' => $order->id,
'total' => $order->total,
]);
2. No Log Rotation
# Always configure rotation
# config/logging.php
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'days' => 7, // Keep only 7 days locally
],
3. Ignoring Security
# Never log sensitive data
Log::info('User logged in', [
'user_id' => $user->id,
// NOT: 'password' => $password,
// NOT: 'api_key' => $apiKey,
// NOT: 'credit_card' => $cc,
]);
Comparison: $50 vs Enterprise
┌──────────────────────┬────────────┬──────────────┐
│ Feature │ $50/month │ Enterprise │
├──────────────────────┼────────────┼──────────────┤
│ Log collection │ ✓ │ ✓ │
│ Full-text search │ ✓ │ ✓ │
│ Basic alerting │ ✓ │ ✓ │
│ 30-day retention │ ✓ │ ✓ │
│ Dashboards │ ✓ │ ✓ │
│ APM/Tracing │ Limited │ Full │
│ ML anomaly detection │ ✗ │ ✓ │
│ SOC2/HIPAA │ ✗ │ ✓ │
│ 24/7 support │ ✗ │ ✓ │
│ Custom integrations │ Limited │ Full │
└──────────────────────┴────────────┴──────────────┘
When to Upgrade
Upgrade from the $50 stack when:
- You're spending more time managing logs than debugging
- Enterprise customers require compliance certifications
- You need features that are expensive to build
- The cost of downtime exceeds the cost of better tools
401 Clicks for Startups
401 Clicks offers startup-friendly pricing:
- Free tier to get started (1 GB/mo, 3-day retention)
- Starter at $19/month (5 GB/mo, 7-day retention)
- Pro at $49/month (25 GB/mo, 15-day retention, unlimited projects)
- Fast search and alerting on all paid plans
- No surprise bills
Conclusion
You don't need to spend thousands on logging when you're starting out. A $50/month setup gives you everything you need to debug production issues, set up alerts, and maintain visibility into your application.
Start simple: use a managed service to avoid infrastructure overhead, implement structured logging from day one, and set up basic alerting for errors. As you grow, you can scale your logging stack alongside your application - but there's no reason to pay enterprise prices when you're still finding product-market fit.
Admin
Published on January 15, 2026