log-analysis
Skill4 starsChanged 9 months agoMITView on GitHub
Implement structured logging and analyze logs to diagnose issues. Use when the user sets up logging, asks about log levels, needs to trace requests through distributed systems, or is analyzing log output to debug a problem. Apply when adding logging to any application.
- Reads credentials
7 other projects use a version of this.
Adopted by
Most recently taken up by
- NVIDIA/nvidia-resiliency-exttheir own version, first seen Aug 28, 2026
- arjunprabhulal/agent-skillstheir own version, first seen Aug 3, 2026
- NailShakurov/logziptheir own version, first seen Jun 8, 2026
- 312362115/claudetheir own version, first seen Apr 8, 2026
- UnitOneAI/SecuritySkillstheir own version, first seen Mar 31, 2026
- autohandai/community-skillstheir own version, first seen Mar 9, 2026
Other versions7 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 7
- NVIDIA/nvidia-resiliency-ext★ 338same name
- 312362115/claude★ 107same name
- UnitOneAI/SecuritySkills★ 78same name
- NailShakurov/logzip★ 12same name
- autohandai/community-skills★ 11same name
- arjunprabhulal/agent-skills★ 4same name
- agenticdevops/devops-execution-engine★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository78 other files it gives its agents.
- AGENTS.mdAGENTS.md
- rules/agents.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/claude-initial-setup.mdcCursor rule
- parallel-task-executionSkill
- subagent-patternsSkill
- task-coordinationSkill
- agent-communicationSkill
- context-managementSkill
- multi-agent-orchestrationSkill
- deploy-strategiesSkill
- github-actions-guideSkill
- pipeline-patternsSkill
- anthropic-sdk-guideSkill
- prompt-engineeringSkill
- tool-use-patternsSkill
- automated-review-setupSkill
- pr-standardsSkill
- review-checklistSkill
- file-organizationSkill
- immutability-patternsSkill
- naming-conventionsSkill
- branching-strategySkill
- commit-conventionsSkill
- pr-workflowSkill
- migration-patternsSkill
- query-optimizationSkill
- schema-design-guideSkill
- error-tracingSkill
- systematic-debuggingSkill
- django-admin-customizationSkill
- django-orm-masterySkill
- drf-api-patternsSkill
- docker-compose-guideSkill
- dockerfile-best-practicesSkill
- multi-stage-buildsSkill
- express-error-handlingSkill
- middleware-patternsSkill
- rest-api-nodeSkill
- async-fastapiSkill
- dependency-injection-fastapiSkill
- pydantic-validationSkill
- concurrency-patterns-goSkill
- error-handling-goSkill
- idiomatic-goSkill
- automation-triggersSkill
- hook-recipesSkill
- pre-post-hooksSkill
- junit-testingSkill
- maven-gradle-guideSkill
- spring-boot-patternsSkill
- mcp-resource-patternsSkill
- mcp-server-creationSkill
- mcp-tool-designSkill
- context-optimizationSkill
- knowledge-persistenceSkill
- memory-patternsSkill
- caching-strategiesSkill
- lazy-loading-patternsSkill
- profiling-guideSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 4 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 26
Always log structured data, not interpolated strings:
- Distinctive: line 76
Use levels consistently across the entire application:
- Distinctive: line 153
Add persistent context to every log entry from a scope:
- Distinctive: line 194
Logging sensitive data: Never log passwords, tokens, credit card numbers, SSNs, or PII without masking.
“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Log Analysis
Implement structured, queryable logging with proper levels and correlation IDs to enable fast diagnosis of production issues.
When to Use
- Adding logging to an application or service
- Choosing appropriate log levels
- Debugging production issues via log output
- Setting up log aggregation (ELK, Datadog, CloudWatch)
- Tracing requests across multiple services
Core Patterns
Structured Logging (JSON)
Always log structured data, not interpolated strings:
// BAD: Unstructured string logs
console.log(`User ${userId} failed to login from ${ip} with error: ${err.message}`);
// Hard to parse, search, and aggregate
// GOOD: Structured JSON logging
import pino from "pino";
const logger = pino({ level: "info" });
logger.error({
event: "login_failed",
userId,
ip,
error: err.message,
errorCode: err.code,
}, "User login failed");# Python structured logging
import structlog
logger = structlog.get_logger()
logger.error(
"login_failed",
user_id=user_id,
ip=ip,
error=str(err),
error_code=getattr(err, "code", None),
)// Go structured logging with slog
import "log/slog"
slog.Error("login failed",
"event", "login_failed",
"userId", userId,
"ip", ip,
"error", err.Error(),
)Log Levels
Use levels consistently across the entire application:
LEVEL WHEN TO USE EXAMPLE
----- ----------- -------
error Something failed, needs attention Database connection lost
Action: alert on-call, investigate Payment processing failed
warn Unexpected but handled, may need review Rate limit approaching
Action: review in daily triage Deprecated API called
info Normal but significant operations User registered
Action: none, useful for auditing Order completed
debug Detailed flow for development Cache hit/miss
Action: none, disabled in production SQL query executedconst logger = pino({ level: process.env.LOG_LEVEL || "info" });
// ERROR: Operation failed, requires investigation
logger.error({ orderId, error: err.message }, "Payment charge failed");
// WARN: Handled but notable
logger.warn({ userId, attempts: 4, max: 5 }, "Login attempt threshold approaching");
// INFO: Normal business events
logger.info({ orderId, total, itemCount }, "Order placed successfully");
// DEBUG: Development-time detail (disabled in production)
logger.debug({ query, params, durationMs: 12 }, "Database query executed");Correlation IDs for Request Tracing
Assign a unique ID to each request and propagate it through all logs and service calls:
import { randomUUID } from "crypto";
import { AsyncLocalStorage } from "async_hooks";
const requestContext = new AsyncLocalStorage<{ correlationId: string }>();
// Middleware: assign correlation ID
function correlationMiddleware(req: Request, res: Response, next: NextFunction) {
const correlationId = req.headers["x-correlation-id"] as string || randomUUID();
res.setHeader("x-correlation-id", correlationId);
requestContext.run({ correlationId }, () => next());
}
// Logger: include correlation ID automatically
function getLogger() {
const ctx = requestContext.getStore();
return logger.child({ correlationId: ctx?.correlationId });
}
// Usage in any handler or service
function processOrder(order: Order) {
const log = getLogger();
log.info({ orderId: order.id }, "Processing order");
// All logs from this request share the same correlationId
}Output enables tracing a single request across services:
{"level":"info","correlationId":"abc-123","service":"api","msg":"Order received","orderId":"ord-1"}
{"level":"info","correlationId":"abc-123","service":"inventory","msg":"Stock reserved","orderId":"ord-1"}
{"level":"info","correlationId":"abc-123","service":"payment","msg":"Payment charged","orderId":"ord-1"}
{"level":"error","correlationId":"abc-123","service":"email","msg":"Notification failed","error":"SMTP timeout"}Log Context Enrichment
Add persistent context to every log entry from a scope:
// Child loggers for adding scope context
const serviceLogger = logger.child({ service: "order-service", version: "2.1.0" });
const requestLogger = serviceLogger.child({ correlationId, userId });
// All logs from this request include service, version, correlationId, userId
requestLogger.info({ orderId }, "Order created");# Python: bind context to logger
logger = structlog.get_logger()
log = logger.bind(service="order-service", correlation_id=correlation_id, user_id=user_id)
log.info("order_created", order_id=order_id)
# Output includes all bound context automaticallyAnalyzing Logs
# Search JSON logs with jq
# Find all errors for a specific correlation ID
cat app.log | jq 'select(.correlationId == "abc-123" and .level == "error")'
# Count errors by type in the last hour
cat app.log | jq 'select(.level == "error") | .event' | sort | uniq -c | sort -rn
# Find slow requests (> 1000ms)
cat app.log | jq 'select(.durationMs > 1000) | {path: .path, duration: .durationMs}'
# Trace a request across services
cat *.log | jq 'select(.correlationId == "abc-123")' | jq -s 'sort_by(.timestamp)'Anti-Patterns
What NOT to Do
- Logging sensitive data: Never log passwords, tokens, credit card numbers, SSNs, or PII without masking.
- String interpolation in log messages:
logger.info(\User ${id}`)` defeats structured search. Use fields. - Logging inside tight loops: Thousands of log entries per second saturate I/O and storage.
- Inconsistent levels: Using
errorfor non-errors orinfofor debug-level detail makes filtering useless. - Missing context:
logger.error("Failed")— failed what? Add the operation, entity ID, and error.
// BAD: Sensitive data in logs
logger.info({ password: user.password }, "User login");
// BAD: No context
logger.error("Something went wrong");
// BAD: Wrong level
logger.error("Cache miss for key: user:123"); // This is debug, not error
// GOOD: Masked sensitive data, full context, correct level
logger.info({ userId: user.id, email: maskEmail(user.email) }, "User login successful");
logger.error({ orderId, error: err.message, stack: err.stack }, "Payment processing failed");
logger.debug({ key: "user:123", hit: false }, "Cache lookup");Quick Reference
Log Levels:
error Operation failed, needs attention
warn Unexpected but handled
info Normal significant events
debug Development detail
Structured Logging Checklist:
- JSON format, not string interpolation
- Consistent field names across services
- Correlation ID on every request
- Timestamps in ISO 8601 (UTC)
- Service name and version in every entry
- Error entries include message + stack
- No sensitive data (mask PII, tokens)
Libraries:
Node.js: pino, winston
Python: structlog, python-json-logger
Go: slog (stdlib), zap, zerolog
Java: SLF4J + Logback, Log4j2
Analysis:
jq Query JSON logs from the command line
grep -c Count occurrences
tail -f Follow log output in real timeDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

