aloof-scooter-47164
12/07/2025, 3:06 PMtall-airline-16756
12/07/2025, 3:06 PMtall-airline-16756
12/07/2025, 3:06 PMlk agent logs
• For historic/long-term runtime logs, forward logs to an external provider (Datadog, CloudWatch, Sentry, or New Relic) by adding the appropriate secret (e.g., DATADOG_TOKEN, `AWS_ACCESS_KEY_ID`/`AWS_SECRET_ACCESS_KEY`, SENTRY_DSN, NEW_RELIC_LICENSE_KEY). Once configured, view historic runtime logs in that provider.
Build logs
• View build logs for deployed versions via the CLI:
lk agent logs --log-type=build
• You can also view build logs for multiple versions from the LiveKit Cloud dashboard.
Session (Agent Observability) logs
• Enable Agent Observability in Project → Data and privacy.
• Open the Sessions dashboard → Agent insights to see session-level logs, transcripts, traces, and synchronized logs.
• You can download a session’s data (ZIP with logs, audio, transcripts, traces).
• Observability data is retained for 30 days.
If you tell me which log type you need (runtime, build, or session) and whether you already have an external log provider configured, I’ll give exact next steps for your setup.
Sources: Log collection | LiveKit Docs | Agent insights in LiveKit Cloud | LiveKit docsaloof-scooter-47164
12/07/2025, 3:14 PMtall-airline-16756
12/07/2025, 3:14 PMaloof-scooter-47164
12/07/2025, 4:52 PMtall-airline-16756
12/07/2025, 4:52 PMaloof-scooter-47164
12/07/2025, 7:32 PMtall-airline-16756
12/07/2025, 7:32 PMaloof-scooter-47164
12/07/2025, 7:32 PMtall-airline-16756
12/07/2025, 7:33 PMclients with your Loki HTTP endpoint.
◦ Adds scrape_configs pointing at the LiveKit log file paths or container journald.
◦ Sets labels (e.g., job=livekit, project=<your-project>, agent=<agent-name>).
◦ Optionally defines pipeline_stages to parse JSON logs or extract fields.
1. Start Promtail; it will push logs to Loki where Grafana can query them.
Example Promtail config sections (conceptual)
• clients:
◦ url: http//<loki host>3100/loki/api/v1/push
• scrape_configs:
◦ job_name: livekit
static_configs:
• targets: ['localhost']
labels: job: livekit path: /var/log/livekit/*.log
• pipeline_stages (optional):
◦ json:
expressions: level: level msg: message
Notes specific to LiveKit
• LiveKit Cloud does not natively export to Loki; you must run Promtail yourself or route logs from a supported provider (CloudWatch/New Relic) into Loki.
• If your agents run in LiveKit Cloud where you cannot install Promtail, forward logs to CloudWatch or New Relic and then pull or forward them into Loki.
Tell me:
• Where your agents run (Kubernetes, VMs, or LiveKit Cloud)
• Whether LiveKit logs are files or stdout/journald
I’ll provide a ready-to-use Promtail config and exact deployment steps for your environment.aloof-scooter-47164
12/07/2025, 7:34 PMtall-airline-16756
12/07/2025, 7:35 PMlk agent logs (note: this only shows the newest agent server instance).
1. Normalize and batch
◦ Parse each log line and attach metadata labels (e.g., job=livekit-agent, project, agent, room).
◦ Buffer and batch entries to avoid per-line HTTP calls.
1. Format for Loki push API
◦ Send JSON with `streams`: each stream has stream (labels) and values (array of [timestamp_ns, line]).
◦ Timestamps must be nanoseconds since epoch and properly escaped strings.
◦ Example payload:
{
"streams": [
{
"stream": {
"job": "livekit-agent",
"agent": "my-agent"
},
"values": [
[
"1717765955000000000",
"level=info msg='Agent started' room=my-room"
]
]
}
]
}
1. Push over HTTP
◦ POST to Loki endpoint: http://<loki-host>:3100/loki/api/v1/push
◦ Handle retries, backoff, and HTTP errors.
1. Operational concerns
◦ Run the side job per host/instance (or as a DaemonSet/sidecar) to capture all instances; lk agent logs alone won’t cover past instances at scale.
◦ Implement batching, rate limiting, and retry/backpressure to avoid overloading Loki.
◦ Preserve timestamps from logs where possible; otherwise use ingestion time.
◦ Ensure proper label selection to enable efficient queries in Grafana (avoid high-cardinality labels like unique request IDs).
◦ Secure traffic (TLS) and authentication if your Loki endpoint requires it.
1. Log level & completeness
◦ Adjust agent log level with the agent option --log-level to include needed detail.
◦ If agents run in LiveKit Cloud where you cannot install collectors, forward logs to a supported provider (CloudWatch/New Relic) and then route into Loki.
If you tell me:
• Where agents run (Kubernetes, VMs, LiveKit Cloud)
• Whether logs are files or stdout/journald
• Your Loki endpoint and auth method (basic token/TLS)
I’ll provide a ready-to-run example script or Promtail-equivalent config tailored to your environment.
Sources: Log collection | LiveKit Docs | Agent server options | LiveKit docsaloof-scooter-47164
12/07/2025, 7:36 PMtall-airline-16756
12/07/2025, 7:36 PMlk agent logs
(This is not historic for all instances.)
• Use Agent Observability for session-level logs, transcripts, traces:
◦ Enable Agent Observability in Project → Data and privacy.
◦ View/download session data from Sessions → Agent insights (retained 30 days).
• Forward runtime logs to a supported external provider (required for historic logs):
◦ Supported targets: Datadog, AWS CloudWatch, Sentry, New Relic.
◦ Configure the appropriate secret (e.g., DATADOG_TOKEN, `AWS_ACCESS_KEY_ID`/`AWS_SECRET_ACCESS_KEY`, SENTRY_DSN, NEW_RELIC_LICENSE_KEY) so LiveKit forwards logs automatically.
How to get logs into Loki from LiveKit Cloud
• Option A — Provider → Loki: Forward LiveKit logs to CloudWatch or New Relic, then configure a forwarder that sends data from that provider into Loki (Grafana supports CloudWatch/New Relic).
• Option B — Provider export → Promtail: Export logs from your chosen provider and push into Loki with Promtail/your own forwarder.
• Option C — Pull session data: For session-specific traces/transcripts, download session ZIPs from Agent insights and ingest those into your systems (manual).
Next step Tell me which external provider you already have (Datadog, CloudWatch, New Relic, Sentry) or whether you want step-by-step for:
• Configuring LiveKit to forward to CloudWatch or New Relic (then into Loki), or
• Exporting Session data from Agent Observability and ingesting into Loki
I’ll provide the exact secrets/keys and step-by-step configuration for that path.