LiveKit docs › Manage & Deploy › Agent deployment › Logs

---

# Log collection

> Monitor and debug your deployed agents with comprehensive logging.

## Overview

LiveKit Cloud provides realtime logging for your deployed agents, helping you monitor performance, debug issues, and understand your agent's behavior in production. Logs are collected from all phases of your agent's lifecycle — from build to runtime — and can be forwarded to external monitoring services such as [Datadog](https://www.datadoghq.com/), [CloudWatch](https://aws.amazon.com/cloudwatch/), [Sentry](https://sentry.io/), and [New Relic](https://newrelic.com/). You can also view some logs with the LiveKit CLI.

## Log types

LiveKit Cloud collects two types of logs for your agents:

- **Runtime logs**: Your agent's app logs, including stdout, stderr, and any other logging you implement.
- **Build logs**: Output from the container build process, including Dockerfile execution and dependency installation.

## Follow runtime logs

Use the LiveKit CLI to follow logs from your deployed agents in realtime.

```shell
lk agent logs

```

This command continuously streams logs from the latest running instance of your agent. It also includes a short snapshot of recent logs.

> ℹ️ **Single instance**
> 
> The LiveKit CLI shows logs from the most recently started agent server instance only. When your agent scales to more than one instance, logs from the other instances don't appear. To collect logs from all instances, [forward runtime logs](#forward-runtime-logs) to an external service.

## View build logs

Use the LiveKit CLI to view the Docker build logs from the currently deployed version of your agent.

```shell
lk agent logs --log-type=build

```

This command prints the logs to stdout, but does not perform a live tail.

Build logs from more versions of your agent are available in the [LiveKit Cloud dashboard](https://cloud.livekit.io/projects/p_/agents).

## View runtime logs

Runtime logs are available in three places. Each place covers a different set of logs and keeps them for a different length of time:

- **Logs from one session.** Open the session on the [Sessions](https://cloud.livekit.io/projects/p_/sessions) page and select the **Agent insights** tab. Session logs appear on the timeline beside the transcript, traces, and audio for that session, so you can read a log line against the turn that produced it. Only project admins can read them. See [Agent insights](https://docs.livekit.io/testing/observability/insights.md).
- **Logs from the running instance.** Use `lk agent logs` to tail the most recently started agent server instance, as described in [Follow runtime logs](#follow-runtime-logs). Use it to watch logs that don't belong to a session, such as startup output, as they happen.
- **Long-term logs from every instance.** Forward runtime logs to an external service with a [log drain](#forward-runtime-logs). A log drain also receives events outside of a session, such as crashes, startup failures, and dispatch errors.

## Forward runtime logs

Forward your agent logs to external monitoring services for long-term storage, advanced analytics, and integration with your existing observability stack.

The currently supported destinations are Datadog, CloudWatch, Sentry, and New Relic.

### Datadog integration

Add a [Datadog](https://docs.livekit.io/deploy/agents/secrets.md) client token as a [secret](https://docs.livekit.io/deploy/agents/secrets.md) to automatically enable log forwarding. If your account is in a region other than `us1`, you can also set the region. All runtime logs are automatically forwarded to your Datadog account.

```shell
lk agent update-secrets --secrets "DATADOG_TOKEN=your-client-token"

```

- **`DATADOG_TOKEN`** _(string)_: Your Datadog [client token](https://docs.datadoghq.com/account_management/api-app-keys/#client-tokens).

- **`DATADOG_REGION`** _(string)_ (optional) - Default: `us1`: Your Datadog region. Supported regions are `us1`, `us3`, `us5`, `us1-fed`, `eu`, and `ap1`.

#### Log fields

The following log fields are set in Datadog for all log lines sent from LiveKit Cloud:

| Field | Value | Description |
| --- | --- | --- |
| host | <agent-server-id> | A unique identifier for the specific agent server instance emitting the log. |
| source | <agent-id> | The ID of the agent, as in `livekit.toml` and the dashboard. |
| service | `"cloud.livekit.io"` |  |
| stream | `stdout` or `stderr` | Indicates whether the log originated from stdout or stderr. |

### CloudWatch integration

Add a [CloudWatch](https://docs.livekit.io/deploy/agents/secrets.md) `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` as [secrets](https://docs.livekit.io/deploy/agents/secrets.md) to automatically enable log forwarding. The AWS region defaults to `us-west-2`, you can set it by setting the `AWS_REGION` secret. All runtime logs are automatically forwarded to your CloudWatch account.

```shell
lk agent update-secrets --secrets "AWS_ACCESS_KEY_ID=your-access-key-id" --secrets "AWS_SECRET_ACCESS_KEY=your-secret-access-key"

```

- **`AWS_ACCESS_KEY_ID`** _(string)_: Your AWS [access key ID](https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html).

- **`AWS_SECRET_ACCESS_KEY`** _(string)_: Your AWS [secret access key](https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html).

- **`AWS_REGION`** _(string)_ (optional) - Default: `us-west-2`: Your AWS region. See the [AWS regions](https://docs.aws.amazon.com/global-infrastructure/latest/regions/aws-regions.html) page for a list of all supported regions.

### Sentry integration

Add a [Sentry](https://docs.livekit.io/deploy/agents/secrets.md) `SENTRY_DSN` as a [secret](https://docs.livekit.io/deploy/agents/secrets.md) to automatically enable log forwarding. All runtime logs are automatically forwarded to your Sentry account.

```shell
lk agent update-secrets --secrets "SENTRY_DSN=your-sentry-dsn"

```

- **`SENTRY_DSN`** _(string)_: Your Sentry [DSN](https://docs.sentry.io/product/sentry-basics/dsn-explainer/).

### New Relic integration

Add a [New Relic](https://docs.livekit.io/deploy/agents/secrets.md) `NEW_RELIC_LICENSE_KEY` as a [secret](https://docs.livekit.io/deploy/agents/secrets.md) to automatically enable log forwarding. All runtime logs are automatically forwarded to your New Relic account.

```shell
lk agent update-secrets --secrets "NEW_RELIC_LICENSE_KEY=your-license-key"

```

- **`NEW_RELIC_LICENSE_KEY`** _(string)_: Your New Relic [license key](https://docs.newrelic.com/docs/apis/intro-apis/new-relic-api-keys/).

## Log levels

Your agent server configuration determines the log levels that are collected and forwarded. The default log level is `info`. To use a different value, set the log level in your Dockerfile:

```dockerfile
CMD ["python", "agent.py", "start", "--log-level=debug"]

```

You can also set the log level with the `LIVEKIT_LOG_LEVEL` environment variable, which is useful when you want to adjust verbosity without rebuilding your image. Set it as a [secret](https://docs.livekit.io/deploy/agents/secrets.md):

```shell
lk agent update-secrets --secrets "LIVEKIT_LOG_LEVEL=debug"

```

For more information on log levels, see the [agent server options](https://docs.livekit.io/agents/server/options.md#log-levels) page.

## Log retention

Agent build logs are stored indefinitely for the most recently deployed version. To learn about runtime log retention, see the [Agent insights](https://docs.livekit.io/testing/observability/insights.md#retention-window) page.

## Additional resources

The following resources may be helpful to design a logging strategy for your agent:

- **[Agent observability](https://docs.livekit.io/testing/observability.md)**: Guide to monitoring your agent's behavior in production.

- **[Agent server options](https://docs.livekit.io/agents/server/options.md)**: Learn how to configure your agent server.

- **[Secrets management](https://docs.livekit.io/deploy/agents/secrets.md)**: Learn how to securely manage API keys for log forwarding.

- **[Agent CLI reference](https://docs.livekit.io/reference/developer-tools/livekit-cli/agent/deployment/manage.md#logs)**: Reference for `lk agent logs` and the other commands that manage deployed agents.

---

This document was rendered at 2026-12-04T20:29:24.682Z.
For the latest version of this document, see [https://docs.livekit.io/deploy/agents/logs.md](https://docs.livekit.io/deploy/agents/logs.md).

To explore all LiveKit documentation, see [llms.txt](https://docs.livekit.io/llms.txt).