Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

AI DB Observability Recipe

No security coverage

Part of the AI ecosystem · 345 projects

This Drupal recipe stores AI provider events in your database, providing a searchable log and usage charts to track AI activity. It includes details on requests, tokens, and models, all presented through editable Views.

AI observability with Views is a Drupal recipe that stores Drupal AI provider events in your SQL database and gives you a searchable event log and four usage charts, all built as editable Views under /admin/reports/ai-requests.

What you get after applying

A Reports menu entry named AI requests with a paginated event log, an event detail page showing the captured prompt and response, and bar charts for requests per day, requests per model, tokens per model and tokens per day. Every page is a Views display you can change at /admin/structure/views.

Features

  • Event log: one row per provider lifecycle event (request started, response received, streaming response received, provider disabled) with filters for UTC date prefix, provider, model, operation, user ID, event name and request ID. The request ID links the start and completion events of a single call.
  • Event detail: time, provider, model, operation, user, reported tokens, request ID, the captured prompt and response text, provider configuration, tags and the token usage breakdown (input, output, reasoning, cached).
  • AI request volume: requests started per UTC day.
  • AI requests by model: requests started per provider and model.
  • AI tokens by model: reported total tokens per provider and model.
  • AI token trend: reported total tokens per UTC day.
  • Data tables under every chart: the numbers behind each chart are rendered as a table, so the reports work without JavaScript and with screen readers.
  • Shared filters on charts: date prefix, provider, model and operation filters narrow every chart.
  • Plain SQL storage: events are written by the AI Observability submodule through Logger and Logger DB. No external service, agent or OpenTelemetry collector is required.

How counting works

The log lists events, not requests. Request charts count only request-start events. Token charts sum the total token usage reported on completion and streaming completion events. Missing usage is left out rather than estimated as zero. Day buckets use UTC and days without events are omitted. Provider-disabled events never count as requests.

Coverage is limited to calls that go through the Drupal AI provider layer. Calls made directly through a vendor SDK are invisible. Failed or abandoned calls can leave a start event without a completion. The recipe does not report latency, error rates or monetary cost, because the AI Observability module does not record that data.

Recipe inputs

Prompt and response text capture are on by default. To keep request metadata but skip the text, pass the two inputs as 0:

php vendor/bin/dr recipe:apply recipes/ai_recipe_observability_views --input='ai_recipe_observability_views.log_input=0' --input='ai_recipe_observability_views.log_output=0'

You can change text capture later in the AI Observability settings.

The recipe sets Logger to write to the database only, down to the info level, and replaces any existing Logger targets and field selection. This affects every Drupal logging channel, not only AI. Re-add file or syslog targets afterwards if you need them. Logs can contain prompts, responses and provider configuration, so review Logger DB retention (93 days by default with cron cleanup) and who holds the Administer AI Observability permission. No role receives that permission automatically.

Configuration effects

  • Enables AI Observability logging for all four supported lifecycle events and removes the tag restriction.
  • Sets Logger output to the database target and defines the stored fields: service name, UUID, time, timestamp, channel, severity, raw message, request URI, user ID, metadata and exception. Undefined context fields are stored too.
  • Adds five Views, one AI requests Reports menu link and the chart tabs.
  • Leaves providers, credentials, role permissions, OpenTelemetry settings, Logger DB retention and the default Charts configuration untouched. Chart.js loads through Charts library discovery with a CDN fallback.

Related Modules

Other ways to see AI activity

Modules that record or expose AI requests and token usage.

Requirements/Dependencies

  • AI 1.4.0 or later, with its AI Observability submodule, plus a configured AI provider to produce events. The recipe does not configure credentials or choose a model.
  • Logger 1.0.0-alpha6 or later and Logger DB 1.0.0-alpha4 or later. Both are alpha releases and are not covered by the Drupal security advisory policy.
  • Charts 5.2.3 or later with its bundled Chart.js integration.
  • Drupal 11.4 or later. Logger DB alpha4 was tested with the legacy mysql database driver name and does not yet support Drupal 11.4's namespaced driver identifier.
  • NOTE: This recipe assumes that you know how to setup AI module and a provider, this will only setup the logging part.

Ask your assistant about AI DB Observability Recipe

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
3
Tracked since
Sep 2026
Latest release
1 month ago
Releases (12 mo)
3 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Core PHP Release date
1.0.0-beta3 Pre-release Sep 16, 2026
1.0.0-beta2 Pre-release Sep 8, 2026
1.0.0-beta1 Pre-release Sep 6, 2026