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

> System table containing information about all successful and failed login and logout events.

# system.session_log

<Info>
  **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](/reference/system-tables/overview#system-tables-in-clickhouse-cloud) for further details.
</Info>

<h2 id="description">
  Description
</h2>

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

<h2 id="columns">
  Columns
</h2>

* `hostname` ([LowCardinality(String)](/reference/data-types/lowcardinality)) — Hostname of the server executing the query.
* `type` ([Enum8('LoginFailure' = 0, 'LoginSuccess' = 1, 'Logout' = 2)](/reference/data-types/enum)) — Login/logout result. Possible values: LoginFailure — Login error. LoginSuccess — Successful login. Logout — Logout from the system.
* `auth_id` ([UUID](/reference/data-types/uuid)) — Authentication ID, which is a UUID that is automatically generated each time user logins.
* `session_id` ([String](/reference/data-types/string)) — Session ID that is passed by client via HTTP interface.
* `event_date` ([Date](/reference/data-types/date)) — Login/logout date.
* `event_time` ([DateTime](/reference/data-types/datetime)) — Login/logout time.
* `event_time_microseconds` ([DateTime64(6)](/reference/data-types/datetime64)) — Login/logout starting time with microseconds precision.
* `user` ([Nullable(String)](/reference/data-types/nullable)) — User name.
* `auth_type` ([Nullable(Enum8('NO\_PASSWORD' = 0, 'PLAINTEXT\_PASSWORD' = 1, 'SHA256\_PASSWORD' = 2, 'DOUBLE\_SHA1\_PASSWORD' = 3, 'LDAP' = 4, 'KERBEROS' = 5, 'SSL\_CERTIFICATE' = 6, 'BCRYPT\_PASSWORD' = 7, 'SSH\_KEY' = 8, 'HTTP' = 9, 'JWT' = 10, 'SCRAM\_SHA256\_PASSWORD' = 11, 'NO\_AUTHENTICATION' = 12))](/reference/data-types/nullable)) — The authentication type.
* `profiles` ([Array(LowCardinality(String))](/reference/data-types/array)) — The list of profiles set for all roles and/or users.
* `roles` ([Array(LowCardinality(String))](/reference/data-types/array)) — The list of roles to which the profile is applied.
* `settings` ([Array(Tuple(LowCardinality(String), String))](/reference/data-types/array)) — Settings that were changed when the client logged in/out.
* `client_address` ([IPv6](/reference/data-types/ipv6)) — The IP address that was used to log in/out.
* `client_port` ([UInt16](/reference/data-types/int-uint)) — The client port that was used to log in/out.
* `interface` ([Enum8('TCP' = 1, 'HTTP' = 2, 'gRPC' = 3, 'MySQL' = 4, 'PostgreSQL' = 5, 'Local' = 6, 'TCP\_Interserver' = 7, 'Prometheus' = 8, 'Background' = 9)](/reference/data-types/enum)) — The interface from which the login was initiated.
* `client_hostname` ([String](/reference/data-types/string)) — The hostname of the client machine where the clickhouse-client or another TCP client is run.
* `client_name` ([String](/reference/data-types/string)) — The clickhouse-client or another TCP client name.
* `client_revision` ([UInt32](/reference/data-types/int-uint)) — Revision of the clickhouse-client or another TCP client.
* `client_version_major` ([UInt32](/reference/data-types/int-uint)) — The major version of the clickhouse-client or another TCP client.
* `client_version_minor` ([UInt32](/reference/data-types/int-uint)) — The minor version of the clickhouse-client or another TCP client.
* `client_version_patch` ([UInt32](/reference/data-types/int-uint)) — Patch component of the clickhouse-client or another TCP client version.
* `failure_reason` ([String](/reference/data-types/string)) — The exception message containing the reason for the login/logout failure.

<h2 id="example">
  Example
</h2>

```sql title="Query" theme={null}
SELECT * FROM system.session_log LIMIT 1 FORMAT Vertical;
```

```text title="Response" theme={null}
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:
```
