ClickHouse/docs/en/operations/system-tables/session_log.md
sevirov 3796da1b4f
Update docs/en/operations/system-tables/session_log.md
Co-authored-by: olgarev <56617294+olgarev@users.noreply.github.com>
2021-10-24 14:50:41 +03:00

4.4 KiB

system.session_log

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

!!! note "Note" User sessions are implicit and rely on the proper co-operation from context users.

Columns:

  • type (Enum8) — Login/logout result. Values:
    • LoginFailure — Login error.
    • LoginSuccess — Successful login.
    • Logout — Logout from the system.
  • session_id (UUID) — Session id.
  • session_name (String) — Session name.
  • event_date (Date) — Login/logout date.
  • event_time (DateTime) — Login/logout time.
  • event_time_microseconds (DateTime64) — Login/logout starting time with microseconds precision.
  • user (String) — User name.
  • auth_type (Enum8) — The authentication type. There are multiple ways of user identification:
    • 'NO_PASSWORD'.
    • 'PLAINTEXT_PASSWORD'.
    • 'SHA256_PASSWORD'.
    • 'DOUBLE_SHA1_PASSWORD'.
    • 'LDAP'.
    • 'KERBEROS'.
  • profiles (Array(LowCardinality(String))) — The list of profiles is set for all roles and/or users.
  • roles (Array(LowCardinality(String))) — The list of roles to which the profile is applied.
  • changed_settings (Array(Tuple(LowCardinality(String), String))) — Settings that were changed when the client logged in/out.
  • client_address (IPv6) — The IP address that was used to log in/out.
  • client_port (UInt16) — The client port that was used to log in/out.
  • interface (Enum8) — The interface from which the login was initiated. Values:
    • 'TCP'.
    • 'HTTP'.
    • 'gRPC'.
    • 'MySQL'.
    • 'PostgreSQL'.
  • client_hostname (String) — The hostname of the client machine where the clickhouse-client or another TCP client is run.
  • client_name (String) — The clickhouse-client or another TCP client name.
  • client_revision (UInt32) — Revision of the clickhouse-client or another TCP client.
  • client_version_major (UInt32) — The major version of the clickhouse-client or another TCP client.
  • client_version_minor (UInt32) — The minor version of the clickhouse-client or another TCP client.
  • client_version_patch (UInt32) — Patch component of the clickhouse-client or another TCP client version.
  • failure_reason (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:
──────
type:                    LoginSuccess
session_id:              45e6bd83-b4aa-4a23-85e6-bd83b4aa1a23
session_name:
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:                   []
changed_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: