Events API#
Events are emitted by the Iguazio backend for internal (services) and external (users) visibility of user actions, security actions and system state. The user can emit (manual) events as long as he has system admin role.
Events are displayed in the Iguazio Events Dashboard.
Before you start, make sure that the igz_mgmt package is installed and that you are logged in to the system with the igz_mgmt.Client API. If not, see Control Plane API.
import igz_mgmt
client = igz_mgmt.Client(username="someone", access_key="some-access-id")
List Events, Audit Events, Communication Events#
Events, Audit Events, Communication Events can be filtered by tenant, source, kind, classification, severity, etc.
This example shows all info-level events for the current tenant:
events = igz_mgmt.Event.list(
client, filter_by={"severity": igz_mgmt.constants.EventSeverity.info}
)
This example shows all security audit events for login failures:
audit_events = igz_mgmt.AuditEvent.list(
client,
filter_by={"kind": "Security.User.Login.Failed"},
)
This example shows audit events with timestamp filtering:
audit_events = igz_mgmt.AuditEvent.list(
client,
filter_by={"timestamp_iso8601": "[$ge]2024-08-04T07:04:00.000Z"},
)
The supported operators are:
- $ge: greater than or equal
- $gt: greater than
- $le: less than or equal
- $lt: less than
- $eq: equal
- $ne: not equal
This example shows all communication events for the current tenant:
communication_events = igz_mgmt.CommunicationEvent.list(client)
Manual events#
Manual events are events that are emitted by the user. If Iguazio-system has predefined “kind” for the events, the parameters text must be accordingly to the event definition. Ask the Support team to learn more.
Create a manual audit event#
import igz_mgmt.resources
import igz_mgmt.schemas.events
event = igz_mgmt.resources.AuditEvent(
source="mlrun-api",
kind="Software.Project.Secret.Created",
visibility=igz_mgmt.constants.EventVisibility.external.value,
classification=igz_mgmt.constants.EventClassification.security.value,
system_event=True,
description="Created a secret",
severity=igz_mgmt.constants.EventSeverity.info.value,
parameters_text=[
igz_mgmt.schemas.events.ParametersText(name="secret_keys", value="a,b,c"),
igz_mgmt.schemas.events.ParametersText(name="secret_name", value="my-secret"),
igz_mgmt.schemas.events.ParametersText(name="project", value="my-project"),
],
)
event.emit(client)