docs/versioned_docs/version-1.10.0/Develop/observability-grafana-loki.mdx
Langflow can emit structured JSON logs for ingestion by Grafana Loki.
This page demonstrates how to connect Langflow to the reference Grafana stack shipped with the Langflow repository. For more information, see the README.
To consume structured Langflow logs with other ingestion providers, see Logs.
In the root folder of your Langflow application, edit your existing .env file or create a new one.
Add the following environment variables. Replace the placeholders with the values for your deployment:
LANGFLOW_LOG_ENV=container
LANGFLOW_LOG_LEVEL=INFO
LANGFLOW_LOG_FILE=/var/log/langflow/langflow.log
LANGFLOW_SERVICE_NAME=langflow
LANGFLOW_VERSION=1.10.0
LANGFLOW_ENVIRONMENT=production
Setting LANGFLOW_LOG_ENV=container switches structlog's terminal processor to JSONRenderer, so every line written to stdout is a JSON object containing the event message, level, timestamp, logger name, exception structure, and service metadata. For more information, see Logs.
The shipped Promtail configuration scrapes *.log files from a directory rather than stdout. LANGFLOW_LOG_FILE must point at a file inside the directory that Promtail watches. Set LANGFLOW_LOG_DIR to that same directory so Langflow creates the file in the right place.
Start the reference Loki + Promtail + Grafana stack from the repository:
cd deploy/observability/grafana-loki
export LANGFLOW_LOG_DIR=/var/log/langflow
docker compose up -d
Launch Langflow with your .env file:
uv run langflow run --env-file .env
Run a flow in Langflow to generate log traffic.
Open Grafana at http://localhost:3000 and navigate to Dashboards > Langflow Logs to view structured log output, including panels for structured tracebacks, PII redaction, stdlib library output, and service/environment/version coverage.