# Query logging settings

Query logging records structured native TCP and HTTP request events. Diagnostic file logging is configured independently.

## Settings

| Setting                           | Type   | Default | Meaning                                            |
| --------------------------------- | ------ | ------- | -------------------------------------------------- |
| log_queries                       | Bool   | 1       | Enable structured request history.                 |
| log_queries_min_query_duration_ms | UInt64 | 0       | Minimum recorded request duration in milliseconds. |

With a zero threshold, enabled logging records a start and a terminal event. A nonzero threshold omits fast requests and records only a terminal event for qualifying requests, including failures.

Disabling log_queries overrides the threshold. Earlier history remains readable.

## Example

```sql
SET log_queries = 1;
SET log_queries_min_query_duration_ms = 100;
```

```sql
SELECT name, value
FROM system.settings
WHERE name IN ('log_queries', 'log_queries_min_query_duration_ms')
ORDER BY name
FORMAT csv;
```

```text
"log_queries","1"
"log_queries_min_query_duration_ms","100"
```

These are persisted database defaults. SET requires autocommit and no active transactions in that database. Read [system.query_log](https://coordinatordb.com/docs/reference/system-tables/query-log) for event types, visibility and metrics.
