Skip to content

AI Query Generation

Logchef turns natural-language questions into queries for whichever datasource and editor mode you are using. It generates LogchefQL in the shared builder, ClickHouse SQL in ClickHouse native mode, and LogsQL in VictoriaLogs native mode. The assistant is schema-aware: it sees the selected source’s columns or discovered fields and types.

  1. Open any log source
  2. Click the AI assistant button (wand icon) in the query editor
  3. Describe what you want in plain English
  4. Review the generated query, then insert it into the editor

If you already have a query in the editor, the AI uses it as context for refinements. Logchef validates the generated query for the active target and makes one repair attempt when it can identify a syntax error.

"Show error logs from the last 6 hours"
"Count logs by severity for today"
"Find logs containing 'connection refused' from the payments service"
"Top 10 most frequent error messages this week"
"Logs where trace_id = 'abc123'"

Configure via Administration → System Settings → AI:

Setting Description Default
Enabled Toggle AI features true
Provider openai or native bedrock transport openai
API Key Your OpenAI API key
Base URL API endpoint https://api.openai.com/v1
Region AWS region when using Bedrock
Model Model name gpt-4o
Max Tokens Max tokens to generate 1024
Temperature Randomness (0.0–1.0) 0.1

Use an OpenAI-compatible API or AWS Bedrock:

Provider Base URL
OpenAI https://api.openai.com/v1 (default)
OpenRouter https://openrouter.ai/api/v1
Azure OpenAI Your Azure endpoint
Local models Your local server URL
AWS Bedrock Native Converse API using the standard AWS credential chain

For containerized deployments, seed the initial config via env vars:

Terminal window
export LOGCHEF_AI__ENABLED=true
export LOGCHEF_AI__PROVIDER=openai
export LOGCHEF_AI__API_KEY="sk-your-key"
export LOGCHEF_AI__MODEL="gpt-4o"

For Bedrock, set LOGCHEF_AI__PROVIDER=bedrock, LOGCHEF_AI__REGION, and a Bedrock model ID or inference-profile ARN. Logchef uses the normal AWS credential chain, so no API key is stored.

After first boot, the Admin UI takes precedence over env vars.

For AI assistant integration outside the web UI (e.g., Claude Desktop), see MCP Server.

Always review AI-generated queries before running them. The model can get complex aggregations or unfamiliar schemas wrong, so start with simple questions and iterate from there.