{"record":{"id":"86163b9021642e99","repo":"langflow-ai/langflow","slug":"log-retrieval-is-disabled","errorCode":null,"errorMessage":"Log retrieval is disabled","messagePattern":"Log retrieval is disabled","errorType":"http","errorClass":"HTTPException","httpStatus":501,"severity":"warning","filePath":"src/backend/base/langflow/api/log_router.py","lineNumber":67,"sourceCode":"                current_not_sent = 0\n                yield \"keepalive\\n\\n\"\n\n        await asyncio.sleep(1)\n\n\n@log_router.get(\"/logs-stream\", dependencies=[Depends(get_current_active_superuser)])\nasync def stream_logs(\n    request: Request,\n):\n    \"\"\"HTTP/2 Server-Sent-Event (SSE) endpoint for streaming logs.\n\n    Requires superuser authentication to prevent exposure of sensitive log data.\n    It establishes a long-lived connection to the server and receives log messages in real-time.\n    The client should use the header \"Accept: text/event-stream\".\n    \"\"\"\n    global log_buffer  # noqa: PLW0602\n    if log_buffer.enabled() is False:\n        raise HTTPException(\n            status_code=HTTPStatus.NOT_IMPLEMENTED,\n            detail=\"Log retrieval is disabled\",\n        )\n\n    return StreamingResponse(event_generator(request), media_type=\"text/event-stream\")\n\n\n@log_router.get(\"/logs\", dependencies=[Depends(get_current_active_superuser)])\nasync def logs(\n    lines_before: Annotated[int, Query(description=\"The number of logs before the timestamp or the last log\")] = 0,\n    lines_after: Annotated[int, Query(description=\"The number of logs after the timestamp\")] = 0,\n    timestamp: Annotated[int, Query(description=\"The timestamp to start getting logs from\")] = 0,\n):\n    \"\"\"Retrieve application logs with superuser authentication required.\n\n    SECURITY: Logs may contain sensitive information and require superuser authentication.\n    \"\"\"\n    global log_buffer  # noqa: PLW0602","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/api/log_router.py#L49-L85","documentation":"HTTP 501 (Not Implemented) returned by GET /api/v1/logs-stream when the in-process log buffer is disabled — log_buffer.enabled() returns max > 0, i.e. the buffer size (configured via the LANGFLOW_LOG_BUFFER env, default 0 in some deployments) is zero. The endpoint also requires superuser auth, so a 401/403 occurs first for non-superusers.","triggerScenarios":"Calling GET /logs-stream with superuser credentials while LANGFLOW_LOG_BUFFER is unset/0, or while running with log buffer disabled (e.g. Uvicorn's default logging setup where the sized buffer is not attached).","commonSituations":"Default deployments where the sized log buffer is disabled; trying to view live logs in the admin UI without enabling log retention.","solutions":["Start langflow with the log buffer enabled and sized, e.g. LANGFLOW_LOG_BUFFER=1000 (env var controlling the SizedLogBuffer max)","Verify with a plain GET /api/v1/logs — it raises the same 501 if the buffer is disabled","If you use a custom logging config, ensure the SizedLogBuffer handler is attached to the root logger"],"exampleFix":"# before\nLANGFLOW_LOG_BUFFER=0 uv run langflow run  # /logs-stream -> 501\n# after\nLANGFLOW_LOG_BUFFER=1000 uv run langflow run  # /logs-stream streams SSE","handlingStrategy":"validation","validationCode":"const probe = await fetch('/api/v1/logs', { headers: auth });\nif (probe.status === 501) { disableLiveLogUI(); } // buffer off, hide streaming tab","typeGuard":null,"tryCatchPattern":"try { const es = new EventSource('/api/v1/logs-stream'); es.onerror = () => fallbackToStdoutLogs(); } catch { fallbackToStdoutLogs(); }","preventionTips":["Set LANGFLOW_LOG_BUFFER > 0 in deployments where the log UI is used","Treat 501 as a permanent configuration state — do not retry","Fall back to container/journald logs when the buffer is disabled"],"tags":["logging","http-501","configuration","superuser"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}