AI Query Generator
Describe what you are looking for in plain language, and LogPulse writes the LPQL query for you. You see the query, so you can check it, change it and learn the syntax along the way.
Overview
The query generator is part of the workspace. It turns a question into one LPQL query and runs it in Search. For questions that need more than one query, such as a root cause, the AI Investigator takes over and runs as many searches as it needs.
Ask in the workspace
Type in Ask anything about your logs⦠and press Enter. Pick the Search mode next to the input when you want a query and its results, rather than an answer in the conversation.
LPQL or a question
The input recognises LPQL. Type index=web status>=500 | stats count by host and it runs as a search straight away, without AI. Type which hosts return the most 5xx errors? and the AI writes that query for you. You can also switch the input to the LPQL editor and back with Ask in natural language.
Refine a search
Below a search you can ask a follow-up, such as only the last hour or split it by host. The AI changes the current query instead of starting over. You can always edit the LPQL in the editor yourself and press Run.
What the AI knows
Before it writes a query, LogPulse gives the AI a picture of your own data, so it uses your real names instead of guessing:
| Context | What it is |
|---|---|
| Indexes, sourcetypes, sources and hosts | Up to 50 of each, seen in the last 7 days |
| Fields | Field names from a sample of up to 500 recent events, including attributes and parsed fields |
| LPQL | The commands and functions LPQL supports |
| The current query | When you refine a search, the query you are looking at |
| The conversation | Earlier questions and answers in the same conversation |
The query then runs as you, so the results only hold the indexes and namespace your role may see.
Checks on the query
A generated query is checked before you get it. It must be valid LPQL and may not use internal fields. If a check fails, the AI gets the error and tries again, up to three times.
Examples
| You ask | You might get |
|---|---|
| errors from the order service in the last 30 minutes | source=order-service level=error earliest=-30m |
| average response time per endpoint today | index=web earliest=@d | stats avg(duration_ms) as avg_ms by endpoint | sort -avg_ms |
| errors per source this week, per hour | level=error earliest=-7d | timechart span=1h count by source |
| failed logins per user, more than 10 | action=failure earliest=-24h | stats count by user | where count > 10 |
The exact query depends on your data: the AI uses the index, source and field names it finds in your organization.
Tips
| Tip | Why |
|---|---|
| Name the index or source if you know it | A narrow search is faster and more precise |
| Say the time span | last hour, yesterday or since 14:00 becomes earliest and latest |
| Say what you want to see | count, per host or over time gives stats or timechart instead of raw logs |
| Check the query | The query is the truth, not the question. Read it before you build an alert on it |
Access and data
The query generator is on every plan, Free included. Questions in the workspace use AI credits, like the AI Investigator. AI runs on Claude via Amazon Bedrock in the EU region Stockholm; Amazon is a US provider. Owners can switch AI off for the whole organization.
API
| Call | What it does |
|---|---|
POST /api/v1/ai/generate-query | Write an LPQL query: prompt (3 to 500 characters), optional currentQuery and conversationHistory (up to 20 messages). Returns query and explanation |
It needs logs:read and allows 10 calls per minute. The call writes the query but does not run it.
curl -X POST https://api.logpulse.io/api/v1/ai/generate-query \
-H "Authorization: Bearer $LOGPULSE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"prompt": "errors per host in the last hour"}'