Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
aj-geddes avatar

Logging Best Practices

  • 636 installs
  • 305 repo stars
  • Updated March 4, 2026
  • aj-geddes/useful-ai-prompts

logging-best-practices is a Claude Code skill that helps developers ship structured searchable logs from TypeScript or Node services into centralized systems like ELK or CloudWatch.

About

logging-best-practices is an observability skill for Node.js and TypeScript backends needing centralized logging. It provides docker-compose setups for Elasticsearch 8.0.0, Logstash 8.0.0, and Kibana 8.0.0 with JSON tcp input pipelines, plus patterns for forwarding structured logs to CloudWatch. Developers reach for logging-best-practices when microservices produce unstructured console output, when on-call engineers cannot search production events, or when ELK or CloudWatch aggregation is being introduced. The skill covers logstash.conf tcp json codecs, index-friendly field naming, and operational log shipping suitable for debugging incidents and building dashboards in Kibana or CloudWatch Logs Insights.

  • Ready-to-run ELK Stack docker-compose with optimized memory settings
  • Logstash pipeline with timestamp parsing and automatic GeoIP enrichment
  • Winston transport examples for shipping logs to Logstash and AWS CloudWatch
  • Centralized logging setup that works for both local development and production
  • Structured JSON logging configuration that supports search and alerting

Logging Best Practices by the numbers

  • 636 all-time installs (skills.sh)
  • Ranked #232 of 1,435 DevOps & CI/CD skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill logging-best-practices

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs636
repo stars305
Security audit3 / 3 scanners passed
Last updatedMarch 4, 2026
Repositoryaj-geddes/useful-ai-prompts

How do you set up centralized logging for Node.js services?

Ship structured, searchable logs from any TypeScript or Node service into centralized systems like ELK or CloudWatch.

Who is it for?

Backend developers introducing structured centralized logging with ELK Stack or CloudWatch for TypeScript and Node.js services.

Skip if: Frontend-only projects, teams already standardized on OpenTelemetry tracing without log changes, or non-Node runtimes without adaptation.

When should I use this skill?

The user needs ELK, Logstash, Kibana, or CloudWatch centralized logging setup for Node.js or TypeScript services.

What you get

docker-compose ELK configs, logstash.conf pipelines, structured JSON log output, and CloudWatch shipping patterns.

  • docker-compose.yml ELK configuration
  • logstash.conf pipeline
  • structured JSON logging patterns

By the numbers

  • Uses Elasticsearch 8.0.0, Logstash 8.0.0, and Kibana 8.0.0
  • Logstash tcp input on port 5000 with JSON codec

Files

SKILL.mdMarkdownGitHub ↗

Logging Best Practices

Table of Contents

Overview

Comprehensive guide to implementing structured, secure, and performant logging across applications. Covers log levels, structured logging formats, contextual information, PII protection, and centralized logging systems.

When to Use

  • Setting up application logging infrastructure
  • Implementing structured logging
  • Configuring log levels for different environments
  • Managing sensitive data in logs
  • Setting up centralized logging
  • Implementing distributed tracing
  • Debugging production issues
  • Compliance with logging regulations

Quick Start

Minimal working example:

// logger.ts
enum LogLevel {
  DEBUG = 0, // Detailed information for debugging
  INFO = 1, // General informational messages
  WARN = 2, // Warning messages, potentially harmful
  ERROR = 3, // Error messages, application can continue
  FATAL = 4, // Critical errors, application must stop
}

class Logger {
  constructor(private minLevel: LogLevel = LogLevel.INFO) {}

  debug(message: string, context?: object) {
    if (this.minLevel <= LogLevel.DEBUG) {
      this.log(LogLevel.DEBUG, message, context);
    }
  }

  info(message: string, context?: object) {
    if (this.minLevel <= LogLevel.INFO) {
      this.log(LogLevel.INFO, message, context);
    }
  }

  warn(message: string, context?: object) {
// ... (see reference guides for full implementation)

Reference Guides

Detailed implementations in the references/ directory:

GuideContents
Log LevelsLog Levels
Structured Logging (JSON)Structured Logging (JSON)
Contextual LoggingContextual Logging
PII and Sensitive Data HandlingPII and Sensitive Data Handling
Performance LoggingPerformance Logging
Centralized LoggingCentralized Logging
Distributed TracingDistributed Tracing
Log Sampling (High-Volume Services)Log Sampling (High-Volume Services)

Best Practices

✅ DO

  • Use structured logging (JSON) in production
  • Include correlation/request IDs in all logs
  • Log at appropriate levels (don't overuse DEBUG)
  • Redact sensitive data (PII, passwords, tokens)
  • Include context (userId, requestId, etc.)
  • Log errors with full stack traces
  • Use centralized logging in distributed systems
  • Set up log rotation to manage disk space
  • Monitor log volume and costs
  • Use async logging for performance
  • Include timestamps in ISO 8601 format
  • Log business events (user actions, transactions)
  • Set up alerts for error patterns

❌ DON'T

  • Log passwords, tokens, or sensitive data
  • Use console.log in production
  • Log at DEBUG level in production by default
  • Log inside tight loops (use sampling)
  • Include PII without anonymization
  • Ignore log rotation (disk will fill up)
  • Use synchronous logging in hot paths
  • Log to multiple transports without need
  • Forget to include error stack traces
  • Log binary data or large objects
  • Use string concatenation (use structured fields)
  • Log every single request in high-volume APIs

Related skills

How it compares

Use logging-best-practices over performance-profiler when the immediate need is log pipeline setup and searchability rather than CPU flamegraphs or load testing.

FAQ

Which log stack versions does logging-best-practices use?

logging-best-practices examples use Elasticsearch 8.0.0, Logstash 8.0.0, and Kibana 8.0.0 in docker-compose with Logstash listening on tcp port 5000 with a JSON codec for structured ingestion.

Which languages does logging-best-practices target?

logging-best-practices targets TypeScript and Node.js services emitting structured JSON logs shippable to ELK Stack or AWS CloudWatch. Configuration includes logstash.conf pipeline examples and docker-compose service definitions.

Is Logging Best Practices safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

DevOps & CI/CDmonitoringinfra

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.