> ## Documentation Index
> Fetch the complete documentation index at: https://cockroachlabs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Logging Overview

export const InternalLink = ({version, path = "", children, ...props}) => {
  let detectedVersion = version || "stable";
  if (typeof window !== 'undefined' && !version) {
    const match = window.location.pathname.match(/\/docs\/([^/]+)/);
    if (match) {
      detectedVersion = match[1];
    }
  }
  const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
  return <a href={`/docs/${detectedVersion}/${normalizedPath}`} {...props}>
      {children}
    </a>;
};

If you need to monitor your cluster, tune performance, or <InternalLink path="troubleshooting-overview">troubleshoot</InternalLink> issues, you can check the CockroachDB logs, which include details about notable cluster, node, and range-level events.

## Details

When a node starts, shuts down, or processes a <InternalLink path="cockroach-commands">`cockroach` command</InternalLink>, it produces a stream of messages about the command's activities. Each message is composed of:

* A payload that contains events either structured in JSON or conveyed in an arbitrary string. For details on structured event types and their fields, see <InternalLink path="eventlog">Notable Event Types</InternalLink>.
* An envelope that contains event metadata (e.g., severity, date, timestamp, channel). Depending on the log format you specify when <InternalLink path="configure-logs#file-logging-format">configuring logs</InternalLink>, the envelope can be formatted either in JSON or as a flat prefix to the message.

Messages are organized into appropriate [logging channels](#logging-channels) and then routed through log sinks. Each sink further processes and filters the messages before emitting them to destinations outside CockroachDB. The mapping of channels to sinks, as well as the processing and filtering done by each sink, is configurable and is intended to support multiple <InternalLink path="logging-use-cases">use cases</InternalLink>. For more information on configuring sinks and severity levels, see <InternalLink path="configure-logs">Configure Logs</InternalLink>.

<Tip>
  All <InternalLink path="cockroach-commands">`cockroach` commands</InternalLink> support logging. However, note that most messages related to cluster operation are generated by <InternalLink path="cockroach-start">`cockroach start`</InternalLink> or <InternalLink path="cockroach-start-single-node">`cockroach start-single-node`</InternalLink>. Other commands generate messages related to their own execution, which are mainly useful when troubleshooting the behaviors of those commands.
</Tip>

## Logging channels

<Note>
  Log channels cannot be completely disabled. You can configure <InternalLink path="configure-logs#configure-log-sinks">how log messages are routed to different sinks</InternalLink> and <InternalLink path="configure-logs#set-logging-levels">adjust verbosity levels</InternalLink>, but you cannot turn off a log channel entirely. For example, a channel that **is not explicitly configured** for a <InternalLink path="configure-logs#output-to-files">file group</InternalLink> **is enabled** in the `default` file group.
</Note>

Log messages in CockroachDB are directed to logging channels, which can in turn be assigned to output to one or more <InternalLink path="configure-logs#configure-log-sinks">log sinks</InternalLink>.

This allows you to group channels that log related information (e.g., operational, security, or SQL events) into their own sinks. Each sink can output to a predetermined destination where the logs can be collected and parsed. For usage examples, see <InternalLink path="logging-use-cases">Logging Use Cases</InternalLink>.

| Channel                                                                                                                                                                                                                                                                                                                | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <InternalLink path="logging">`CHANGEFEED`</InternalLink>                                                                                                                                                                                                                                                               | Changefeed events.<br /><br />**Note**: <InternalLink path="eventlog#changefeed-telemetry-events">Changefeed telemetry events</InternalLink>, which are sent by default to the [`TELEMETRY`](#telemetry) channel in v26.3 and earlier versions, will be routed by default to this channel in a future major release.<br />To prepare for that change and assess potential downstream impacts on your logging setup and pipelines, review the <InternalLink path="logging-overview#log-channel_compatibility_mode-enabled">`log.channel_compatibility_mode.enabled`</InternalLink> cluster setting. After reviewing the documentation, set `log.channel_compatibility_mode.enabled` to `false` in a non-production environment to log these events to this `CHANGEFEED` channel.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| <InternalLink path="logging#dev">`DEV`</InternalLink>                                                                                                                                                                                                                                                                  | Uncategorized and debug messages.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| <InternalLink path="logging#kv_distribution">`KV_DISTRIBUTION`</InternalLink>                                                                                                                                                                                                                                          | Data distribution events, such as moving <InternalLink path="architecture/overview">replicas</InternalLink> between <InternalLink path="cockroach-start#store">stores</InternalLink> in a cluster, adding replicas to <InternalLink path="architecture/overview#range">ranges</InternalLink>, and removing replicas from ranges.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| <InternalLink path="logging">`KV_EXEC`</InternalLink>                                                                                                                                                                                                                                                                  | KV execution events that are not related to distribution.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| <InternalLink path="logging#health">`HEALTH`</InternalLink>                                                                                                                                                                                                                                                            | Resource usage; node-node connection events, including connection errors; up- and down-replication and range unavailability.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| <InternalLink path="logging#ops">`OPS`</InternalLink>                                                                                                                                                                                                                                                                  | Process starts, stops, shutdowns, and crashes (if they can be logged); changes to cluster topology, such as node additions, removals, and decommissions.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| <InternalLink path="logging#privileges">`PRIVILEGES`</InternalLink>                                                                                                                                                                                                                                                    | Changes to privileges and object ownership.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| <InternalLink path="logging#sensitive_access">`SENSITIVE_ACCESS`</InternalLink>                                                                                                                                                                                                                                        | SQL audit events (when enabled via <InternalLink path="alter-table#experimental_audit">`ALTER TABLE ... EXPERIMENTAL_AUDIT`</InternalLink>).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| <InternalLink path="logging#sessions">`SESSIONS`</InternalLink>                                                                                                                                                                                                                                                        | Client connections and disconnections (when enabled via the `server.auth_log.sql_connections.enabled` <InternalLink path="cluster-settings">cluster setting</InternalLink>); SQL authentication logins/attempts and session/query terminations (when enabled via the `server.auth_log.sql_sessions.enabled` <InternalLink path="cluster-settings">cluster setting</InternalLink>).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| <a id="sql_exec" /><InternalLink path="logging#sql_exec">`SQL_EXEC`</InternalLink>                                                                                                                                                                                                                                     | SQL statement executions (when enabled via the `sql.trace.log_statement_execute` <InternalLink path="cluster-settings">cluster setting</InternalLink>) and uncaught Go panic errors during SQL statement execution.<br /><br />**Warning**: Logging cluster-wide executions by enabling the `sql.trace.log_statement_execute` cluster setting will incur considerable overhead and may have a negative performance impact.<br /><br />**Note**: In a future release, the following events will be routed to this channel:<ul><li><InternalLink path="eventlog#sql-slow-query-log">SQL Slow Query Log</InternalLink></li><li><InternalLink path="eventlog#sql-slow-query-log-internal">SQL Slow Query Log (Internal)</InternalLink></li><li><InternalLink path="eventlog#sampled_query">`sampled_query` </InternalLink></li><li><InternalLink path="eventlog#sampled_transaction">`sampled_transaction`</InternalLink></li></ul>To prepare for that change and assess potential downstream impacts on your logging setup and pipelines, set the [`log.channel_compatibility_mode.enabled`](#log-channel_compatibility_mode-enabled) cluster setting to `false` in a non-production environment. This will log these events to this `SQL_EXEC` channel.                                                                                    |
| To prepare for that change and assess potential downstream impacts on your logging setup and pipelines, set the [`log.channel_compatibility_mode.enabled`](#log-channel_compatibility_mode-enabled) cluster setting to `false` in a non-production environment. This will log these events to this `SQL_EXEC` channel. |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| <InternalLink path="logging#sql_perf">`SQL_PERF`</InternalLink>                                                                                                                                                                                                                                                        | SQL executions that impact performance, such as slow queries (enabled via the `sql.log.slow_query.latency_threshold` and `sql.log.slow_query.experimental_full_table_scans.enabled` <InternalLink path="cluster-settings">cluster settings</InternalLink>).<br /><br />**Note**: The `SQL_PERF` and `SQL_INTERNAL_PERF` channels will be removed in a future release. <InternalLink path="eventlog#sql-slow-query-log">SQL Slow Query Log</InternalLink> and <InternalLink path="eventlog#sql-slow-query-log-internal">SQL Slow Query Log (Internal)</InternalLink> events currently sent to the `SQL_PERF` and <InternalLink path="logging#sql_internal_perf">`SQL_INTERNAL_PERF`</InternalLink> channels, respectively, will be routed to the [`SQL_EXEC`](#sql_exec) channel in a future release. Internal queries are tagged as `internal`, allowing users to filter them out downstream.<br /><br />To prepare for that change and assess potential downstream impacts on your logging setup and pipelines, set the [`log.channel_compatibility_mode.enabled`](#log-channel_compatibility_mode-enabled) cluster setting to `false` in a non-production environment. This logs these events to the [`SQL_EXEC`](#sql_exec) channel.                                                                                                  |
| <InternalLink path="logging#sql_schema">`SQL_SCHEMA`</InternalLink>                                                                                                                                                                                                                                                    | Database, schema, table, sequence, view, and type creation; changes to table columns and sequence parameters.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| <InternalLink path="logging#storage">`STORAGE`</InternalLink>                                                                                                                                                                                                                                                          | Low-level storage logs from the <InternalLink path="architecture/storage-layer#pebble">Pebble storage engine</InternalLink>.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| <InternalLink path="logging#telemetry">`TELEMETRY`</InternalLink>                                                                                                                                                                                                                                                      | Telemetry events for internal usage, except for <InternalLink path="eventlog#sampled_query">`sampled_query`</InternalLink> and <InternalLink path="eventlog#sampled_transaction">`sampled_transaction`</InternalLink> events which may be <InternalLink path="log-sql-activity-to-datadog">logged externally to Datadog</InternalLink>.<br /><br />**Note**: `sampled_query` and `sampled_transaction` events, which are sent by default to this channel in v26.3 and earlier versions, will instead be routed by default to the [`SQL_EXEC`](#sql_exec) channel in a future major release. <InternalLink path="eventlog#changefeed-telemetry-events">Changefeed telemetry events</InternalLink>, which are sent by default to this channel in v26.3 and earlier versions, will instead be routed by default to the [`CHANGEFEED`](#changefeed) channel in a future major release.<br />To prepare for these changes and assess potential downstream impacts on your logging setup and pipelines, review the <InternalLink path="logging-overview#log-channel_compatibility_mode-enabled">`log.channel_compatibility_mode.enabled`</InternalLink> cluster setting. After reviewing the documentation, set `log.channel_compatibility_mode.enabled` to `false` in a non-production environment to log these events to their new channels. |
| <InternalLink path="logging#user_admin">`USER_ADMIN`</InternalLink>                                                                                                                                                                                                                                                    | Changes to users, roles, and authentication credentials.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |

Logging channels are analogous to [logging facilities in Syslog](https://wikipedia.org/wiki/Syslog) or [logging services in Datadog](https://docs.datadoghq.com/logs/log_collection/?tab=http#reserved-attributes). For more details on the contents of each logging channel, see the <InternalLink path="logging#logging-channels">Logging reference</InternalLink>.

### `log.channel_compatibility_mode.enabled`

The `log.channel_compatibility_mode.enabled` <InternalLink path="cluster-settings">cluster setting</InternalLink> controls logging channel behavior. When set to:

* `true` (default): Logs are sent to the standard [logging channels](#logging-channels). This maintains the behavior in v25.3 and earlier supported versions. Specifically, the system sends:

  * <InternalLink path="eventlog#changefeed-telemetry-events">Changefeed telemetry events</InternalLink> to the [`TELEMETRY`](#telemetry) channel.
  * <InternalLink path="eventlog#sql-slow-query-log">SQL Slow Query Log</InternalLink> and <InternalLink path="eventlog#sql-slow-query-log-internal">SQL Slow Query Log (Internal)</InternalLink> events to the [`SQL_PERF`](#sql_perf) and <InternalLink path="logging#sql_internal_perf">`SQL_INTERNAL_PERF`</InternalLink> channels, respectively.
  * <InternalLink path="eventlog#sampled_query">`sampled_query`</InternalLink> and <InternalLink path="eventlog#sampled_transaction">`sampled_transaction`</InternalLink> events to the [`TELEMETRY`](#telemetry) channel.

* `false`: Logs are sent to updated logging channels. Specifically, the system sends:

  * <InternalLink path="eventlog#changefeed-telemetry-events">Changefeed telemetry events</InternalLink> to the [`CHANGEFEED`](#changefeed) channel.
  * <InternalLink path="eventlog#sql-slow-query-log">SQL Slow Query Log</InternalLink> and <InternalLink path="eventlog#sql-slow-query-log-internal">SQL Slow Query Log (Internal)</InternalLink> events to the [`SQL_EXEC`](#sql_exec) channel.
  * <InternalLink path="eventlog#sampled_query">`sampled_query`</InternalLink> and <InternalLink path="eventlog#sampled_transaction">`sampled_transaction`</InternalLink> events to the [`SQL_EXEC`](#sql_exec) channel.

<Danger>
  In a future release, `log.channel_compatibility_mode.enabled` is expected to default to `false`. To prepare for that change and assess potential downstream impacts on your logging setup and pipelines, set the `log.channel_compatibility_mode.enabled` cluster setting to `false` in a non-production environment.
</Danger>

## Logging destinations

When using the <InternalLink path="configure-logs#default-logging-configuration">default logging configuration</InternalLink>, the events collected on each [logging channel](#logging-channels) are split into log files as follows:

| Filename                        | Description             | Channels                    |
| ------------------------------- | ----------------------- | --------------------------- |
| `cockroach.log`                 | General CockroachDB log | `DEV`                       |
| `cockroach-changefeed.log`      | Changefeed log          | `CHANGEFEED`                |
| `cockroach-health.log`          | Health log              | `HEALTH`                    |
| `cockroach-kv-distribution.log` | Data distribution log   | `KV_DISTRIBUTION`           |
| `cockroach-kv-exec.log`         | KV execution log        | `KV_EXEC`                   |
| `cockroach-security.log`        | SQL security log        | `PRIVILEGES` + `USER_ADMIN` |
| `cockroach-sql-audit.log`       | SQL access audit log    | `SENSITIVE_ACCESS`          |
| `cockroach-sql-auth.log`        | SQL authentication log  | `SESSIONS`                  |
| `cockroach-sql-exec.log`        | SQL execution log       | `SQL_EXEC`                  |
| `cockroach-sql-slow.log`        | SQL slow query log      | `SQL_PERF`                  |
| `cockroach-sql-schema.log`      | SQL schema change log   | `SQL_SCHEMA`                |
| `cockroach-pebble.log`          | Pebble log              | `STORAGE`                   |
| `cockroach-telemetry.log`       | Telemetry log           | `TELEMETRY`                 |

Logging destinations and many other parameters are configurable via YAML. For details, see <InternalLink path="configure-logs">Configure Logs</InternalLink>.

## See also

* <InternalLink path="configure-logs">Configure logs</InternalLink>
* <InternalLink path="logging">Logging Levels and Channels</InternalLink>
* <InternalLink path="log-formats">Log formats</InternalLink>
* <InternalLink path="eventlog">Notable Event Types</InternalLink>
