Audit Logging
Authentication and audit activity in Hydrolix is logged to the hydro.audit_logs table, accessible through an API or direct SQL queries.
Hydrolix uses Keycloak for authentication. Retrieve authentication events from the HTTP API at https://hostname.hydrolix.live/config/v1/auth_logs using the GET action. The endpoint returns a JSON-formatted list of all Keycloak events.
Filters⚓︎
Specify filters in the request body. These filters include:
-
user_idstring: Includes all Keycloak events created by the given user. To return all Keycloak events regardless of user, exclude the field. -
event_typesarray(string): Specifies all the event types to be included in the response. The most useful event types are:-
LOGIN: A user has successfully logged in and has begun a Keycloak session. The sessionId is included in the Keycloak event object. -
LOGIN_ERROR: Someone has tried logging in as the user and failed. The reason for this failure is included in the error field in the event object (invalid_user_credentials,timed_out, and others). -
USER_DISABLED_BY_TEMPORARY_LOCKOUT: A user has been locked out temporarily, with the reason included in the event object. -
USER_DISABLED_BY_PERMANENT_LOCKOUT: A user has been locked out permanently, with the reason included in the event object.
-
-
from_datestring: Excludes all events that occur before the provided time. Should be in the formatYYYY-MM-DD. -
to_datestring: Excludes all events that occur after the provided time. Should be in the formatYYYY-MM-DD. -
from_timestampint: Excludes all events that occur before the provided epoch timestamp in milliseconds. More precise thanfrom_date. -
to_timestampint: Excludes all events that occur after the provided epoch timestamp in milliseconds. More precise thanto_date. -
ip_addressstring: Filters events by the IP address from which the authentication attempt originated. -
usernamestring: Filters events by username. -
target_userstring: Filters events by target user UUID (for actions performed on other users). -
target_usernamestring: Filters events by target username (for actions performed on other users). -
directionstring: Controls the sort order of results by timestamp. Valid values areASC(ascending, oldest first) orDESC(descending, newest first). -
limitint: Limits the number of events returned in the response. The default limit is 100 events.
RBAC permissions⚓︎
API endpoint permissions⚓︎
The /config/v1/auth_logs endpoint is accessible to users with the view_audit permission. By default, only the super_admin role has this permission on cluster startup. Other roles (user_admin, operator, read_only) don't have access by default and must be explicitly granted the view_audit or view_auth_logs_user permission.
Direct table query permissions⚓︎
Users with the select_sql permission for the hydro.audit_logs table can query authentication and audit events directly using SQL. During cluster initialization, users and roles with global view_audit or view_auth_logs_user permissions automatically receive select_sql permission for the hydro.audit_logs table.
Example API call⚓︎
After setting $HDX_TOKEN and $HDX_HOSTNAME, this command retrieves all login errors from May 19, 2024 onward:
Filter by IP address⚓︎
| Filter Authentication Events by IP Address | |
|---|---|
Filter by timestamp range⚓︎
Use epoch timestamps in milliseconds for more precise time filtering:
| Filter by Timestamp Range | |
|---|---|
Query the hydro.audit_logs table directly⚓︎
This feature was introduced in Hydrolix version 5.6.2 where Config API audit logs moved from a PostgreSQL-backed database to the hydro.audit_logs table. Keycloak authentication events moved to the same table in Hydrolix version 5.8. Both changes improve performance and reduce contention on the PostgreSQL database.
hydro.audit_logs table schema⚓︎
The hydro.audit_logs table contains two types of records:
- Keycloak authentication events: Login attempts, session activity, and lockouts. These moved from a PostgreSQL-backed database to
hydro.audit_logsin Hydrolix version 5.8. - Config API audit events: Actions performed through the Config API, such as creating or modifying projects, tables, transforms, jobs, users, roles, and policies. These moved from a PostgreSQL-backed database to
hydro.audit_logsin Hydrolix version 5.6.2.
Use the source column to distinguish between them: keycloak for authentication events, audit for Config API events.
Key columns include:
timestamp(datetime): When the event occurredsource(string): Event source (keycloakoraudit)source_id(string): Original event ID from the source systemtype(string): Event type (for example,LOGIN,LOGIN_ERROR,create:job)user_id(string): UUID of the user who performed the actionusername(string): Username of the user who performed the actionsession_id(string): Session identifierip_address(string): IP address from which the action originatedresource_id(string): UUID of the affected resource (for audit events)resource_type(string): Type of affected resource (for audit events). Examples:project,table,transform,job,user,role,policytarget_user_id(string): UUID of user affected by the actiontarget_username(string): Username of user affected by the actionerror(string): Error message (for failed authentication attempts)event_details(string): JSON string with additional event details
Audit reporting for internal accounts⚓︎
Internal user accounts hdx@hydrolix.net and hdx.readonly@hydrolix.net were deprecated in Hydrolix version 5.11.
Don't depend on these accounts
To avoid interruption of services, switch to service accounts for all external interaction with Hydrolix cluster APIs.
Cluster-internal automation began switching away from the legacy user accounts in v5.11.
Use this or a similar query to collect evidence of account usage using the audit_logs.
| Collect Recent Evidence of Internal User Account Authentication | |
|---|---|
Query results don't include the system against which the legacy internal user account authenticated. For example, the client could be using the HTTP Stream API or HTTP Query API, or even the Hydrolix UI.
Use the ip_address columns and other application logs to help identify external systems which use the legacy internal user accounts.
See also example queries.
Example queries⚓︎
Find all actions by a specific user within a time range:
| Find User Actions by Time Range | |
|---|---|
Find all actions from a specific IP address:
| Find Actions by IP Address | |
|---|---|
Find all users who made changes to a project:
Find authentication activity for a specific user: