backend-structured-logging

backend-structured-logging is a skill for Claude Code, Codex from j4flmao/agent-skills. It costs 91 tokens per session (5,195 once invoked), scanned A, original, MIT.

A guide to writing logs as consistent JSON records with shared fields such as timestamps, severity, context, and correlation IDs. Correlation IDs link activity across services and requests.

In plain words
What is it for?
Use it to define log schemas, levels, sampling, request context, tracing correlation, and personal-data redaction.
Why use it?
It makes logs easier to search and connect when diagnosing problems in distributed applications. It also covers reducing sensitive personal data in logs.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument; mentions Codex.

Good fit Use it to define log schemas, levels, sampling, request context, tracing correlation, and personal-data redaction.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/j4flmao/agent-skills/structured-logging
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add j4flmao/agent-skills --skill structured-logging
Clone the repo
git clone --depth 1 https://github.com/j4flmao/agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for backend-structured-logging

README.md
[![agentmods](https://agentmods.dev/badge/skills/j4flmao/agent-skills/structured-logging/github.svg)](https://agentmods.dev/skills/j4flmao/agent-skills/structured-logging)
Your own site
<a href="https://agentmods.dev/skills/j4flmao/agent-skills/structured-logging"><img src="https://agentmods.dev/badge/skills/j4flmao/agent-skills/structured-logging/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for backend-structured-logging

Your own site · 80×15
<a href="https://agentmods.dev/skills/j4flmao/agent-skills/structured-logging"><img src="https://agentmods.dev/badge/skills/j4flmao/agent-skills/structured-logging.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 91 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,195 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00091 $0.05195
Opus 5 $0.00046 $0.02597
Sonnet 5 $0.00018 $0.01039
Haiku 4.5 $0.00009 $0.00519

Measured 8d ago against content hash 9cc850046d64, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

backend-structured-logging scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/backend/universal/structured-logging/SKILL.md · 537 lines

How it starts

The opening of the file, as written. The whole thing — 537 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Backend Structured Logging

Purpose

Design structured JSON logging with consistent schema, context propagation, and sampling.

Agent Protocol

Trigger

Exact user phrases: "structured logging", "JSON logging", "log format", "logging best practice", "log levels", "distributed tracing", "log correlation", "structured log", "logging library", "log aggregation", "log output", "log schema", "correlation ID".

Input Context

Before activating, verify:

  • Logging framework (Winston/Pino/Serilog/Log4j/logrus/zerolog)
  • Log aggregation system (Elasticsearch/Loki/CloudWatch/Datadog)
  • Compliance requirements (audit log retention, PII handling, access logs)

Output Artifact

Logging schema and configuration as formatted text.

Response Format

# Log schema (JSON fields)
# Log levels and sampling rules
// Logger configuration
// Context propagation middleware
// PII redaction config

No preamble. No postamble. No explanations. No filler/hedging/transitions. Compress output — why use many token when few do trick.

Completion Criteria

  • Log schema defined with all required fields (timestamp, level, message, context)
  • Log levels configured with production rules (ERROR/WARN/INFO, sampled DEBUG)
  • Log output configured as JSON lines to stdout
  • Context propagation implemented (correlation ID through all async boundaries)
  • Sensitive data redaction with pattern-based masking
  • Sampling strategy defined per log level

Max Response Length

200 lines of configuration and code.

Decision Tree

Which Log Level?

What happened?
  ├── Application cannot continue (OOM, DB connection lost for good)
  │   └── FATAL — page on-call immediately
  ├── Request failed, user got an error
  │   └── ERROR — alert if rate exceeds threshold
  ├── Request succeeded but degraded (fallback used, retry happened)
  │   └── WARN — investigate if persistent
  ├── State transition normal (order created, user registered)
  │   └── INFO — sampled in production
  ├── Need to trace request through the system
  │   └── DEBUG — header-activated per request
  └── Deep internal details (loop iterations, variable values)
      └── TRACE — never enabled in production

Read the full file on GitHub · 537 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 537 lines · 91 tokens per session scan A 9cc850046d64

Subscribe to this mod's changes

backend-structured-logging is a skill published in the GitHub repository j4flmao/agent-skills (23 stars, last pushed 5d ago), licensed MIT. It adds 91 tokens to every session and 5,195 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.