AI-Analyze Log Entry

POST /v1/traffic/logs/{uuid}/analyze

Run an AI analysis on a single log entry — the platform feeds the request, response, latency breakdown, hit policies, and headers to the AI gateway and returns a one-paragraph diagnosis. Useful for "why did this 500 happen?" workflows where you want a starting hypothesis before digging into the upstream logs.

Plan-gated: requires the traffic_inspector entitlement. Each call counts toward your AI usage budget. Returns 501 Not Implemented when the AI gateway is not configured on the deployment.

Path parameters

uuid string (uuid) Req
The log entry's uuid from /traffic/logs.

Deprecated: the legacy integer id is still accepted in the path until the sunset, answered with Deprecation and Sunset headers. Use the uuid.

Request body

analysis_type string
Optional. Which analysis to run — general, security, performance, or debugging. Defaults to a general explanation when omitted (empty body or {}).

Response (200 OK)

result string
The analysis as text (markdown), when the model answers in prose.

When the model answers with JSON instead, that object is returned as-is; its fields depend on analysis_type. The result is cached on the log, so a repeat call for the same analysis_type returns the cached analysis.

Errors

400 Bad Request
An integer id after the sunset (integer_id_unsupported).
401 Unauthorized
Missing auth.
403 Forbidden
Plan doesn't include the traffic_inspector entitlement.
404 Not Found
Log doesn't exist or isn't in your active account (another account's uuid reads exactly like an unknown one).
500
AI gateway error.
501 Not Implemented
AI analysis isn't enabled on this deployment (no AI gateway configured).
Request
curl -X POST "https://api.ngris.com/v1/traffic/logs/019ba303-954b-796c-bf40-f33a26697f74/analyze" \ -H "X-API-KEY: <your_api_key>" \ -H "Content-Type: application/json"
Python
from ngris import Ngris client = Ngris(api_key="<your_api_key>") result = client.traffic.analyze_log("019ba303-954b-796c-bf40-f33a26697f74") print(result.get("result", result))
Response — 200 OK
{ "result": "The upstream took 1244ms before the platform proxy cut the request. The slow path is consistent with a missing index on the `users` query. Check the upstream's slow-query logs for /api/users around 13:01 UTC." }
Was this helpful?
On this page
AI-Analyze Log Entry
Was this helpful?