logging-strategy

Designs structured logging strategies covering log levels, sampling, retention, and aggregation for production systems.

1|Updated Mar 21, 2026
One-click install
npx skills add https://github.com/kalilurrahman/kr-claudiator-skills-original-prompts --skill logging-strategy-kalilurrahman
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: logging-strategy
Source: https://github.com/kalilurrahman/kr-claudiator-skills-original-prompts/tree/main/01-software-dev/logging-strategy
Command: npx skills add https://github.com/kalilurrahman/kr-claudiator-skills-original-prompts --skill logging-strategy-kalilurrahman

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Production systems generate massive log volumes that become expensive, noisy, and hard to query without a deliberate strategy. This Skill produces a complete logging design covering structure, levels, sampling, retention tiers, aggregation tooling, and sensitive data handling. ## Core Features & Use Cases - Structured Log Design: Defines JSON log schemas with required fields like timestamp, level, service, request_id, and event for consistent querying. - Sampling & Retention Planning: Specifies sampling rates for high-volume endpoints and tiered retention across hot, warm, and cold storage to control costs. - Aggregation & Query Patterns: Compares ELK Stack, Datadog, and CloudWatch Logs architectures and provides ready-to-use Elasticsearch query patterns. - Use Case: A team launching a microservices platform uses this Skill to define log categories, set 1% sampling on health checks, configure 30-day hot retention in Elasticsearch, and enforce PII redaction for GDPR compliance. ## Quick Start Design a logging strategy for a production order-processing API handling 1 million requests per day with GDPR compliance requirements.

Frequently Asked Questions about logging-strategy

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I design a logging strategy for production microservices?

Define log categories (application, access, error, audit, security), use structured JSON with required fields like request_id and service, and set retention tiers. Aggregate centrally with ELK, Datadog, or CloudWatch rather than reading logs on individual servers.

What log sampling rate should I use for high-volume endpoints?

Sample 1-10% of successful responses on high-volume endpoints like health checks, but always retain 100% of ERROR and CRITICAL logs. Consistent sampling based on request_id ensures complete traces for sampled requests.

ELK Stack vs Datadog vs CloudWatch Logs for log aggregation?

ELK offers full control without per-GB pricing but requires operational overhead. Datadog provides managed dashboards and APM integration at roughly $0.10/GB ingested. CloudWatch Logs is cheap and AWS-native but has a limited query interface.

How long should production logs be retained?

Keep 7-30 days in hot storage for active debugging, 90 days in warm storage like S3 Standard, and 1+ years in cold storage like S3 Glacier. Audit logs for compliance may require 7-year retention and must be immutable.

How do I handle PII in application logs for GDPR compliance?

Hash fields like email and phone with MD5 before logging, and fully redact highly sensitive data like SSNs. Automate redaction with a sanitize function that processes known sensitive fields before any log write occurs.

Why does synchronous logging slow down my application?

Synchronous logging blocks request handling while waiting for I/O. Use asynchronous handlers like Python's QueueHandler, batch log shipping every 10 seconds or 1000 entries, and compress logs with gzip to reduce overhead.