Skip to main content
Version: 1.10.x (Next)

Logs endpoints

Retrieve logs for your Langflow flows and server.

Enable log retrieval

The /logs endpoint requires log retrieval to be enabled in your Langflow instance.

To enable log retrieval, set the following environment variables in your Langflow .env file, and then start Langflow with uv run langflow run --env-file .env:


_10
LANGFLOW_ENABLE_LOG_RETRIEVAL=True
_10
LANGFLOW_LOG_RETRIEVER_BUFFER_SIZE=10000 // Must be greater than 0
_10
LANGFLOW_LOG_LEVEL=DEBUG // Can be DEBUG, ERROR, INFO, WARNING, or CRITICAL

Stream logs

Stream logs in real-time using Server Sent Events (SSE):

1import os 2 3import requests 4 5base = os.environ.get("LANGFLOW_URL") or os.environ.get("LANGFLOW_SERVER_URL", "") 6api_key = os.environ.get("LANGFLOW_API_KEY", "") 7 8# `/logs-stream` is an SSE endpoint. For doc example stability, only read a small 9# number of events, then close the connection. 10url = f"{base}/logs-stream" 11headers = {"accept": "text/event-stream", "x-api-key": api_key} 12 13response = requests.get(url, headers=headers, stream=True, timeout=30) 14response.raise_for_status() 15 16events_read = 0 17chunks: list[str] = [] 18for line in response.iter_lines(decode_unicode=True): 19 if line: 20 chunks.append(line) 21 events_read += 1 22 if events_read >= 3: 23 break 24 25response.close() 26 27print("\n".join(chunks)) 28
Result
1keepalive 2 3{"1736355791151": "2025-01-08T12:03:11.151218-0500 DEBUG Building Chat Input\n"} 4 5{"1736355791485": "2025-01-08T12:03:11.485380-0500 DEBUG consumed event add_message-153bcd5d-ef4d-4ece-8cc0-47c6b6a9ef92 (time in queue, 0.0000, client 0.0001)\n"} 6 7{"1736355791499": "2025-01-08T12:03:11.499704-0500 DEBUG consumed event end_vertex-3d7125cd-7b8a-44eb-9113-ed5b785e3cf3 (time in queue, 0.0056, client 0.0047)\n"} 8 9{"1736355791502": "2025-01-08T12:03:11.502510-0500 DEBUG consumed event end-40d0b363-5618-4a23-bbae-487cd0b9594d (time in queue, 0.0001, client 0.0004)\n"} 10 11{"1736355791513": "2025-01-08T12:03:11.513097-0500 DEBUG Logged vertex build: 729ff2f8-6b01-48c8-9ad0-3743c2af9e8a\n"} 12 13{"1736355791834": "2025-01-08T12:03:11.834982-0500 DEBUG Telemetry data sent successfully.\n"} 14 15{"1736355791941": "2025-01-08T12:03:11.941840-0500 DEBUG Telemetry data sent successfully.\n"} 16 17keepalive 18

Retrieve logs with optional parameters

Retrieve logs with optional query parameters:

  • lines_before: The number of logs before the timestamp or the last log.
  • lines_after: The number of logs after the timestamp.
  • timestamp: The timestamp to start getting logs from.

The default values for all three parameters is 0. With default values, the endpoint returns the last 10 lines of logs.

1import os 2 3import requests 4 5url = f"{os.getenv('LANGFLOW_URL', '')}/logs?lines_before=0&lines_after=0&timestamp=0" 6 7headers = { 8 "accept": "application/json", 9 "x-api-key": f"{os.getenv('LANGFLOW_API_KEY', '')}", 10} 11 12response = requests.request("GET", url, headers=headers) 13response.raise_for_status() 14 15print(response.text) 16
Result
1{ 2 "1736354770500": "2025-01-08T11:46:10.500363-0500 DEBUG Creating starter project Document Q&A\n", 3 "1736354770511": "2025-01-08T11:46:10.511146-0500 DEBUG Creating starter project Image Sentiment Analysis\n", 4 "1736354770521": "2025-01-08T11:46:10.521018-0500 DEBUG Creating starter project SEO Keyword Generator\n", 5 "1736354770532": "2025-01-08T11:46:10.532677-0500 DEBUG Creating starter project Sequential Tasks Agents\n", 6 "1736354770544": "2025-01-08T11:46:10.544010-0500 DEBUG Creating starter project Custom Component Generator\n", 7 "1736354770555": "2025-01-08T11:46:10.555513-0500 DEBUG Creating starter project Prompt Chaining\n", 8 "1736354770588": "2025-01-08T11:46:10.588105-0500 DEBUG Create service ServiceType.CHAT_SERVICE\n", 9 "1736354771021": "2025-01-08T11:46:11.021817-0500 DEBUG Telemetry data sent successfully.\n", 10 "1736354775619": "2025-01-08T11:46:15.619545-0500 DEBUG Create service ServiceType.STORE_SERVICE\n", 11 "1736354775699": "2025-01-08T11:46:15.699661-0500 DEBUG File 046-rocket.svg retrieved successfully from flow /Users/USER/Library/Caches/langflow/profile_pictures/Space.\n" 12} 13
Search