← Blog
Data & Analytics

What Is Structured Logging for AI? (2026): Fields, Not a Paragraph

By Andrew · October 24, 2026

Structured logging for AI means each model call is stored as named fields, not as a blob of text you grep later. A useful record can answer, with a filter: which model, which prompt version, how many tokens, how long it took, which tool ran, and whether you refused it. A paragraph in a chat transcript cannot answer those questions for a day of traffic.

The wider habit of opening one bad answer is what AI observability is. The count that should appear as its own field when you refuse a caller is what AI rate limiting is. The field that should name the backup model, when you swapped, is what AI fallback routing is.

Prices are US list prices excluding tax from directory pages checked October 16, 2026. Published October 24, 2026. The directory does not list a logging-vendor fee, so this page does not invent one. We did not audit any vendor’s log format.

Fields worth a column

FieldWhy you filter on itA blob that fails the filter
Model idA regression started when this id changed“The AI replied”
Prompt versionYou can separate a prompt bug from a model bugThe full prompt pasted into a sentence
Input and output tokens, or creditsCost per feature, not per vendorThe monthly invoice
LatencyTime to first token and time to done, separately“It felt slow”
Tool name and statusA failed tool is a different incident from a rude answerThe final paragraph only
DecisionAllowed, refused, shed, or fell backAn HTTP 500 for all of them
flowchart TD
  call["A model call finishes or fails"] --> fields["Write fields: model, prompt version, tokens, latency, tool, decision"]
  fields --> store["Store the row where you can filter"]
  store --> ask{"Can you count refusals for one prompt version today?"}
  ask -->|No| fix["The log is still a paragraph. Add the missing field"]
  ask -->|Yes| keep["Sample ordinary rows, not only incidents"]

Keep the prompt text if policy allows, in a field of its own, with a retention date. Do not require an engineer to reconstruct the prompt from a summary. A secret in that field is now in the log. Strip keys before you write the row. The fence around what the model may do is what AI guardrails are.

What a chat seat will not do for you

A product chat is a transcript. It is not a warehouse of fields. Use it to draft the field list. Export the operational record somewhere you can count.

JobToolWhat the card supportsWhat it does not replace
Draft the field list from an incident you pasteClaude Pro at $20 a month, or $17 billed annuallyA Project for the schema noteThe production log
A shared note about which fields are requiredChatGPT Business at $20 a user a month billed annually, minimum twoAdmin controls. No training on business data by defaultA queryable store
Count an export you already haveHex Professional at $36 an editor a month. Team at $75 adds schedules and alertsA notebook on rows you loadedCapture of the call itself
File a ticket when a field shows a refusal spikeMake Core at $9 a month billed annually for 10,000 creditsA side workflowThe row
An API you call yourself, which you can logDeepSeek API input from $0.15 per 1 million tokens off-peak on a cache missA token rate you can put in the cost fieldA logger

The schedule that tells you yesterday’s export arrived is a data-ops job: best AI tools for data ops. Hex’s plan split is Hex pricing explained.

If you cannot name the prompt version, you cannot canary it. The rollout that depends on this field is what an AI canary release is.

What to leave out

Leave out the customer’s full document if the question only needed a paragraph, unless retention rules say you must keep it. Leave out a “helpfulness” score you have not defined. A number with no rubric will be managed. The rubric is an eval. The log is the evidence the call happened.

A free-text “notes” field is allowed for the human who handled the exception. It is not a substitute for the decision field. If the decision is only in the notes, you cannot count it.

FAQ

Is a JSON line enough?

Yes, if the keys are stable. The format is less important than the promise that model means the model id every time. A spreadsheet with those columns is enough at small volume. The failure is a paragraph.

Do I log the full prompt?

Log the version always. Log the text when you are allowed to, and when you will actually open it. A prompt you are not allowed to store should be hashed or omitted, and the version id should still be there. Policy decides. The model does not.

Can I reconstruct fields from the chat later?

Sometimes, for one incident, by hand. You cannot reconstruct a day of token counts from memory. Write the fields when the call returns.

Does observability require a separate vendor?

It requires the fields and a place to filter them. A vendor can be that place. A table you already run can be that place. A chat window is not that place. Start from the fields. Buy a product when the table stops answering the filter.

Last verified

October 16, 2026 for the prices named above. Published October 24, 2026. Definitions do not depend on a price change.

Sources: Claude pricing, ChatGPT pricing, Hex pricing.

Published by Andrew for AI Tools Optimizer.

Hex is in the data and analytics directory. Directory pages may use affiliate links. A purchase through them may earn us a commission at no extra cost to you.

Disclosure: this post may contain affiliate links. If you buy through them we may earn a commission at no extra cost to you.

Tools mentioned in this post