pub struct AuditEvent {
pub id: String,
pub created_at: u64,
pub action: AuditAction,
pub user_id: Option<String>,
pub actor_id: Option<String>,
pub tenant_id: Option<String>,
pub ip: Option<String>,
pub user_agent: Option<String>,
pub success: bool,
pub reason: Option<String>,
pub metadata: HashMap<String, String>,
}Expand description
One audit-log row. Writes are append-only; the only mutation path is creating a new event.
Fields§
§id: StringStable id (evt_<24-base64url>).
created_at: u64Unix-epoch seconds. Wall-clock from the server’s perspective.
action: AuditActionWhat happened. Stable enum so SIEM dashboards can match on
well-known names. Apps that need bespoke events use
AuditAction::Custom("...").
user_id: Option<String>User the event is ABOUT (subject). Distinct from actor_id
— an admin disabling a user’s account has actor=admin,
subject=user.
actor_id: Option<String>User who PERFORMED the action. Same as user_id for self-
service flows. None for system-driven events
(token-refresh tick, scheduled cleanup).
tenant_id: Option<String>Active org / tenant when the action happened — set when the
caller’s session had tenant_id.
ip: Option<String>Source IP of the request. Apps with a CDN should ensure this is the REAL client IP (X-Forwarded-For has been parsed).
user_agent: Option<String>Truncated User-Agent string. Cap at 256 chars at write time.
success: boolTrue iff action succeeded. Failed-login events are still
logged with success=false so SIEM can spot brute force.
reason: Option<String>Free-form short reason on failure (“WRONG_PASSWORD”, “RATE_LIMITED”). Plain strings — no template interpolation.
metadata: HashMap<String, String>Stringly-typed structured metadata. Avoid putting secrets here; the audit log is meant to be readable by ops.
Trait Implementations§
Source§impl Clone for AuditEvent
impl Clone for AuditEvent
Source§fn clone(&self) -> AuditEvent
fn clone(&self) -> AuditEvent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more