AI-Analyze Log Entry

POST /v1/traffic/logs/{id}/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

id string Req
Log entry ID.

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)

analysis string
AI-generated diagnostic text (markdown). Suitable for direct display.
classification string
Coarse bucket: upstream_timeout, auth_failure, policy_block, upstream_5xx, client_error, unknown.
suggestions string[]
Concrete next-step suggestions ("Check upstream my-service's slow-query logs", "Bump rate limit on /api/users"). Optional.
ai_provider, ai_model string
Backend used.

Errors

401 Unauthorized
Missing auth.
403 Forbidden
Plan doesn't include the traffic_inspector entitlement.
404 Not Found
Log doesn't exist.
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/log-abc-123/analyze" \ -H "X-API-KEY: <your_api_key>"
Python
from ngris import Ngris client = Ngris(api_key="<your_api_key>") result = client.traffic.analyze_log("log-abc-123") print(result["classification"]) print(result["analysis"])
Response — 200 OK
{ "analysis": "The upstream took 1244ms before the platform proxy cut the request — slowest call on this endpoint in the last 5 minutes. The slow path is consistent with a missing index on the `users` query.", "classification": "upstream_timeout", "suggestions": [ "Check the upstream's slow-query logs for /api/users around 13:01 UTC", "Consider adding a 30s timeout circuit-breaker rule on this endpoint" ], "ai_provider": "anthropic", "ai_model": "default" }
On this page
AI-Analyze Log Entry
Iris