system.session_log

[Edit this page](https://github.com/ClickHouse/ClickHouse/tree/master/docs/en/operations/system-tables/session_log.md)

Querying in ClickHouse Cloud

The data in this system table is held locally on each node in ClickHouse Cloud. Obtaining a complete view of all data, therefore, requires the `clusterAllReplicas` function. See [here](/docs/operations/system-tables/overview#system-tables-in-clickhouse-cloud) for further details.

Contains information about all successful and failed login and logout events.

Columns:

- `hostname` ([LowCardinality(String)](/docs/sql-reference/data-types/string)) — Hostname of the server executing the query.
- `type` ([Enum8](/docs/sql-reference/data-types/enum)) — Login/logout result. Possible values:
  - `LoginFailure` — Login error.
  - `LoginSuccess` — Successful login.
  - `Logout` — Logout from the system.
- `auth_id` ([UUID](/docs/sql-reference/data-types/uuid)) — Authentication ID, which is a UUID that is automatically generated each time user logins.
- `session_id` ([String](/docs/sql-reference/data-types/string)) — Session ID that is passed by client via [HTTP](/docs/interfaces/http) interface.
- `event_date` ([Date](/docs/sql-reference/data-types/date)) — Login/logout date.
- `event_time` ([DateTime](/docs/sql-reference/data-types/datetime)) — Login/logout time.
- `event_time_microseconds` ([DateTime64](/docs/sql-reference/data-types/datetime64)) — Login/logout starting time with microseconds precision.
- `user` ([String](/docs/sql-reference/data-types/string)) — User name.
- `auth_type` ([Enum8](/docs/sql-reference/data-types/enum)) — The authentication type. Possible values:
  - `NO_PASSWORD`
  - `PLAINTEXT_PASSWORD`
  - `SHA256_PASSWORD`
  - `DOUBLE_SHA1_PASSWORD`
  - `LDAP`
  - `KERBEROS`
  - `SSL_CERTIFICATE`
- `profiles` ([Array](/docs/sql-reference/data-types/array)([LowCardinality(String)](/docs/sql-reference/data-types/lowcardinality))) — The list of profiles set for all roles and/or users.
- `roles` ([Array](/docs/sql-reference/data-types/array)([LowCardinality(String)](/docs/sql-reference/data-types/lowcardinality))) — The list of roles to which the profile is applied.
- `settings` ([Array](/docs/sql-reference/data-types/array)([Tuple](/docs/sql-reference/data-types/tuple)([LowCardinality(String)](/docs/sql-reference/data-types/lowcardinality), [String](/docs/sql-reference/data-types/string)))) — Settings that were changed when the client logged in/out.
- `client_address` ([IPv6](/docs/sql-reference/data-types/ipv6)) — The IP address that was used to log in/out.
- `client_port` ([UInt16](/docs/sql-reference/data-types/int-uint)) — The client port that was used to log in/out.
- `interface` ([Enum8](/docs/sql-reference/data-types/enum)) — The interface from which the login was initiated. Possible values:
  - `TCP`
  - `HTTP`
  - `gRPC`
  - `MySQL`
  - `PostgreSQL`
- `client_hostname` ([String](/docs/sql-reference/data-types/string)) — The hostname of the client machine where the [clickhouse-client](/docs/interfaces/client) or another TCP client is run.
- `client_name` ([String](/docs/sql-reference/data-types/string)) — The `clickhouse-client` or another TCP client name.
- `client_revision` ([UInt32](/docs/sql-reference/data-types/int-uint)) — Revision of the `clickhouse-client` or another TCP client.
- `client_version_major` ([UInt32](/docs/sql-reference/data-types/int-uint)) — The major version of the `clickhouse-client` or another TCP client.
- `client_version_minor` ([UInt32](/docs/sql-reference/data-types/int-uint)) — The minor version of the `clickhouse-client` or another TCP client.
- `client_version_patch` ([UInt32](/docs/sql-reference/data-types/int-uint)) — Patch component of the `clickhouse-client` or another TCP client version.
- `failure_reason` ([String](/docs/sql-reference/data-types/string)) — The exception message containing the reason for the login/logout failure.

**Example**

Query:

```
SELECT * FROM system.session_log LIMIT 1 FORMAT Vertical;
```

Result:

```
Row 1:
──────
hostname:                clickhouse.eu-central1.internal
type:                    LoginSuccess
auth_id:                 45e6bd83-b4aa-4a23-85e6-bd83b4aa1a23
session_id:
event_date:              2021-10-14
event_time:              2021-10-14 20:33:52
event_time_microseconds: 2021-10-14 20:33:52.104247
user:                    default
auth_type:               PLAINTEXT_PASSWORD
profiles:                ['default']
roles:                   []
settings:                [('load_balancing','random'),('max_memory_usage','10000000000')]
client_address:          ::ffff:127.0.0.1
client_port:             38490
interface:               TCP
client_hostname:
client_name:             ClickHouse client
client_revision:         54449
client_version_major:    21
client_version_minor:    10
client_version_patch:    0
failure_reason:
```

Was this page helpful?