Start studying
Module 14 · MLOps / LLMOps Module contents
Module 14  ·  Card 12 / 22beginner

Logging

Logging records what your system did and when.

For LLM systems you log prompts, responses, tokens, latency and cost.

Structured logs as JSON are queryable in a way plain text is not.

Trace IDs let you follow one request across several services.

Never log secrets or personal data without redaction.

Learn in depth ↓
Module 14 · MLOps / LLMOps · 22 concepts
In depth  /  15 lines

Logging, in more detail

Logging is the record of what your system did and when.

It is the first thing you reach for when something goes wrong.

For a language model system, log the prompt, the response, the token counts, latency and cost.

Log the model version and any prompt version too.

Without those you cannot tell whether a change caused a complaint.

Structured logs as JSON are queryable, and plain text is not.

Searching a text log for all slow requests from one customer is painful.

A trace identifier lets you follow a single request across services.

In an agent, log every step: the tool chosen, the arguments, the result.

Agents fail in the middle, and without a trace debugging is guesswork.

Never log secrets, keys or personal data without redaction.

Prompts frequently contain personal data by their nature, which makes this a real obligation.

Redact at the point of logging, not later, since logs get copied.

Set retention deliberately, because keeping everything forever is a liability.

Sample high-volume logs rather than dropping the field you will want.

Want the full technical article? Wikipedia ↗
Test yourself

One question on this card. Every option explains itself once you pick, right or wrong.

Question 1
Why write logs as structured JSON rather than plain sentences?
MLOps / LLMOps

22 concepts in this module, then a graded test with every answer explained.

Study this module →
↑↓ move↵ openesc close