djd1m/dz-harness/12factor-logs-as-streams

Claude Code and agent skill by djd1m/dz-harness

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Decide HOW a running process emits logs — as an unbuffered, time-ordered event stream to stdout, one event per line, with the app deliberately ignorant of routing, rotation, and storage. Covers where log output goes (stdout vs a file path the app opens), whether writes are buffered, and who owns capture, collation, archival, and alerting (the execution environment, not the code). Litmus: in dev you watch the stream in your terminal; in prod a router (Fluentd, Logplex) captures and ships it to d…

Install

npx vskill@latest install djd1m/dz-harness/12factor-logs-as-streams

SKILL.md

The same SKILL.md was published earlier as djd1m/dz-harness/12factor-logs-as-streams.

Logs as event streams — write events to stdout, let the environment handle the rest

Decision

How a process should handle its logs — treat every log line as one event in a continuous, time-ordered stream and write it unbuffered to stdout. Do not make the app open a logfile, rotate it, choose a storage path, or ship it anywhere. Emission is the app's job; capture, routing, and archival belong to the execution environment.

Draw the line first: the app produces a stream, the platform decides its fate. A logfile on disk, if one exists at all, is just one output format the environment happened to pick — not an artifact the code manages. The app stays deliberately ignorant of the final destination so the same stream can be tailed live, dropped to a file, fed to an indexer, or piped into a warehouse without a code change.

Protocol

  1. Emit, don't manage. Write each event to stdout. Never call code that opens a named logfile,

picks a directory, or rotates on size/time — that responsibility is being pushed onto the environment on purpose.

  1. One event per line. Keep output line-oriented so a router can split the stream cleanly. The lone

exception is a multi-line item such as an exception backtrace.

  1. Write unbuffered. Flush events immediately so they surface in real time rather than sitting in an

app-side buffer.

  1. Assume nothing about the destination. The code must not know or configure where logs end up —

no archival path, no index name, no shipping endpoint in app code.

  1. Local vs deployed behaves the same for the app. In development the engineer simply watches the

stream in the terminal foreground. In staging/prod the execution environment captures each process's stream, collates streams across the whole app, and routes them to one or more destinations the app can neither see nor set.

  1. Put handling downstream, outside the app. Searching history, graphing trends (e.g. requests per

minute), and threshold alerts (e.g. errors/minute over a limit) all live in the log-handling layer — an indexer (Splunk-class) or a general data warehouse (Hadoop/Hive-class) — fed after stdout, never inside the process.

  1. Supply a router if the platform lacks one. stdout-only logging assumes something captures the

stream. On bare processes with no capturing layer, stand up a router (Fluentd, Logplex) rather than reintroduce in-app file management.

Criteria / litmus table
QuestionIf yes →If no →
Does the app open/rotate/ship a logfile itself?Anti-pattern — emit to stdout insteadCompliant — emission only
Is output written unbuffered, one event per line?Events surface live and routers can split themFix buffering / line-orientation
Does app code know the archival or index destination?Boundary violated — make it invisible to the appHandling correctly externalized
Can you just watch the stream in a dev terminal?Emission model is rightSomething is intercepting/writing files in-app
Does a router capture and collate every process stream in prod?Handling layer existsAdd a router before you lose logs

Anti-patterns

Anti-patternWhy it failsKU
App opens a named logfile and manages the pathTies the app to a destination; the environment can no longer route freelyku01
In-app log rotation on size/timeRotation is the environment's job; the process is doing platform workku01
Buffered log writesEvents lag reality; live tailing and prompt alerting breakku01
App code shipping logs to a fixed archive/index endpointCrosses the emission/handling boundary; destinations should be invisible to the appku02
A logging dependency that both emits and rotates/shipsBundles environment concerns into the app; externalize the shipping halfku02
stdout-only on bare processes with no capturing layerStreams vanish; you must supply a router (Fluentd/Logplex), not re-add in-app filesku01

Related decisions

  • 12factor-config-in-environment — this skill says logs must not know their destination; when a

downstream shipper does need a target or credentials, those come from env vars, not app constants. Config supplies the shipper's handle; logs stay a naive stdout stream. (logs↔config)

  • 12factor-backing-services-as-resources — a log-indexing system is just another attachable backing

resource consumed downstream of stdout; the app treats it as swappable and never wires to it directly.

  • 12factor-stateless-processes — because each process only streams events and owns no logfile, it

keeps no local log state, reinforcing disposable, stateless processes.

Источник

Источник: The Twelve-Factor App — Factor XI: Logs (Treat logs as event streams), 12factor.net (CC BY 4.0). © the Twelve-Factor authors. Distilled, paraphrased, unreviewed (trust_tier 0). Knowledge units: 12factor-f11-ku01, 12factor-f11-ku02. Deep reference: references/knowledge-units.md.

Self-check

  • [x] Both listed KUs (ku01 stream-to-stdout, ku02 emission-vs-handling boundary) are covered.
  • [x] Decision framed as HOW to handle logs, distinct from config supply and resource attachment.
  • [x] Boundary clause points to 12factor-config-in-environment and 12factor-backing-services-as-resources.
  • [x] Paraphrased in own words — no verbatim run ≥ 8 words from the source.
  • [x] trust_tier 0 (machine-distilled, unreviewed).

Examples

  • «писать логи в файл и ротировать их внутри приложения или отдавать в stdout?» → stream events to

stdout unbuffered, one per line; drop in-app file opening and rotation — let the execution environment capture and route the stream.

  • "Our logging library opens app.log and rotates it nightly — is that twelve-factor?" → no; the app is

doing the environment's job. Emit to stdout and hand capture/rotation/shipping to a router.

  • «как собрать логи со всех процессов и воркеров в одном месте?» → don't aggregate inside the app; each

process just streams to stdout, and a router (Fluentd/Logplex) collates the streams and ships them.

  • "Where do search, requests-per-minute graphs, and error-rate alerts belong?" → in a downstream

log-handling layer (indexer or data warehouse) fed after stdout, never wired into the process itself.

  • «у нас голые процессы без платформы, куда денутся логи из stdout?» → they can be lost — stand up a

capturing router rather than reintroducing in-app logfile management.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/djd1m/dz-harness/12factor-logs-as-streams/badge)](https://verified-skill.com/skills/djd1m/dz-harness/12factor-logs-as-streams)

Something wrong with this skill or its page? Tell us.