FusionAuth.AuditLogs (FusionAuth v0.3.0) View Source
The FusionAuth.AuditLogs
module provides access functions to the FusionAuth Audit Logs API.
All functions require a Tesla Client struct created with FusionAuth.client(base_url, api_key, tenant_id)
.
Audit Log Fields
- data :: map()
Additional details of an audit log.
- newValue :: String.t()
The new value of the changed object.
- oldValue :: String.t()
The previous value of the changed object.
- reason :: String.t()
The reason why the audit log was created.
- id :: integer()
The Audit Log unique id.
- insertInstant :: integer()
The instant when the Audit Log was created.
- insertUser :: String.t()
The user that created the Audit Log.
- message :: String.t()
The message of the Audit Log.
Link to this section Summary
Functions
Create an audit log.
Export the audit logs. The response will be a compressed archive byte stream with a Content-Type
of application/zip
.
Get an audit log by ID.
Search and paginate through audit logs.
Link to this section Types
Link to this section Functions
Specs
Create an audit log.
Examples
iex> client = FusionAuth.client(...)
iex> FusionAuth.AuditLogs.create_audit_log(client, %{insertUser: "john.doe@email.com", message: "This is a new audit log."})
{
:ok,
%{
"auditLog" => %{
"id" => 212,
"insertInstant" => 1594942979998,
"insertUser" => "john.doe@email.com",
"message" => "This is a new audit log."
}
},
%Tesla.Env{...}
}
For more information visit the FusionAuth API Documentation for Add an Entry to the Audit Log.
Specs
export_audit_logs(client(), export_criteria()) :: result()
Export the audit logs. The response will be a compressed archive byte stream with a Content-Type
of application/zip
.
Examples
iex> client = FusionAuth.client(...)
iex> FusionAuth.AuditLogs.export(client, %{start: 1594922276379, user: "john.doe@email.com"})
{
:ok,
<<80, 75, 3, 4, 20, 0, 8, 8, 8, 0, 77, 188, 240, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 13, 0, 0, 0, 97, 117, 100, 105, 116, 95, 108, 111, 103, 46, 99, 115,
118, 237, 125, 107, 115, 19, ...>>,
%Tesla.Env{...}
}
For more information visit the FusionAuth API Documentation for Export Audit Logs.
Specs
Get an audit log by ID.
Examples
iex> client = FusionAuth.client(...)
iex> FusionAuth.AuditLogs.get_audit_log(client, 211)
{
:ok,
%{
"auditLog" => %{
"id" => 211,
"insertInstant" => 1594922276379,
"insertUser" => "john.doe@email.com",
"message" => "Deleted user registration for user with Id [12345] and the application with Id [67892]",
"reason" => "FusionAuth User Interface"
}
},
%Tesla.Env{...}
}
For more information visit the FusionAuth API Documentation for Retrieve an Audit Log.
Specs
search_audit_logs(client(), search_criteria()) :: result()
Search and paginate through audit logs.
Examples
iex> client = FusionAuth.client(...)
iex> FusionAuth.AuditLogs.search(client, %{message: "Deleted*", numberOfResults: 2, user: "john.doe@email.com"})
{
:ok,
%{
"auditLogs" => [
%{
"id" => 211,
"insertInstant" => 1594922276379,
"insertUser" => "john.doe@email.com",
"message" => "Deleted user registration for user with Id [12345] and the application with Id [67892]",
"reason" => "FusionAuth User Interface"
},
%{
"id" => 208,
"insertInstant" => 1594920876552,
"insertUser" => "john.doe@email.com",
"message" => "Deleted user with Id [12345]",
"reason" => "FusionAuth User Interface"
}
],
"total" => 62
},
%Tesla.Env{...}
}
For more information visit the FusionAuth API Documentation for Search the Audit Log.