pub struct AuditEvent {
pub at_ms: u64,
pub kind: String,
pub identity: Option<Identity>,
pub client: Option<String>,
pub route: Option<String>,
pub command: Option<String>,
pub session_id: Option<u64>,
pub exit_code: Option<i32>,
pub timed_out: Option<bool>,
pub duration_ms: Option<u64>,
pub status: Option<u16>,
pub reason: Option<String>,
}Expand description
One recorded event.
Fields§
§at_ms: u64Unix milliseconds. A number rather than a formatted string so the log stays sortable without a date parser.
kind: StringWhat happened: execute, denied, …
identity: Option<Identity>Caller identity, when the request was authenticated.
client: Option<String>Client address as the server saw it.
route: Option<String>Request method and path, for correlating with access logs.
command: Option<String>The command line, for execution events.
This is the substance of the trail — “someone called POST /execute” says almost nothing on its own. It also means a command that embeds a secret puts that secret in the log, which is the trade an audit trail makes.
session_id: Option<u64>Session the command ran in, when it was not a one-shot.
exit_code: Option<i32>Process exit code, when the command completed.
timed_out: Option<bool>Whether the command hit its timeout.
duration_ms: Option<u64>How long it took.
status: Option<u16>HTTP status, for denial events.
reason: Option<String>Why a request was refused (missing-token, invalid-token, …).
Implementations§
Source§impl AuditEvent
impl AuditEvent
Sourcepub fn with_identity(self, identity: Option<Identity>) -> Self
pub fn with_identity(self, identity: Option<Identity>) -> Self
Attach the caller’s identity.
Sourcepub fn with_client(self, client: impl Into<String>) -> Self
pub fn with_client(self, client: impl Into<String>) -> Self
Attach the client address.
Sourcepub fn with_route(self, route: impl Into<String>) -> Self
pub fn with_route(self, route: impl Into<String>) -> Self
Attach the request route.
Sourcepub fn with_command(self, command: impl Into<String>) -> Self
pub fn with_command(self, command: impl Into<String>) -> Self
Attach the command line that ran.
Sourcepub fn with_session(self, session_id: u64) -> Self
pub fn with_session(self, session_id: u64) -> Self
Attach the session the command ran in.
Sourcepub fn with_outcome(
self,
exit_code: Option<i32>,
timed_out: bool,
duration_ms: u64,
) -> Self
pub fn with_outcome( self, exit_code: Option<i32>, timed_out: bool, duration_ms: u64, ) -> Self
Attach the outcome of an execution.
Sourcepub fn with_denial(self, status: u16, reason: impl Into<String>) -> Self
pub fn with_denial(self, status: u16, reason: impl Into<String>) -> Self
Attach a refusal.
Trait Implementations§
Source§impl Clone for AuditEvent
impl Clone for AuditEvent
Source§fn clone(&self) -> AuditEvent
fn clone(&self) -> AuditEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AuditEvent
impl Debug for AuditEvent
Source§impl<'de> Deserialize<'de> for AuditEvent
impl<'de> Deserialize<'de> for AuditEvent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for AuditEvent
impl PartialEq for AuditEvent
Source§impl Serialize for AuditEvent
impl Serialize for AuditEvent
impl StructuralPartialEq for AuditEvent
Auto Trait Implementations§
impl Freeze for AuditEvent
impl RefUnwindSafe for AuditEvent
impl Send for AuditEvent
impl Sync for AuditEvent
impl Unpin for AuditEvent
impl UnsafeUnpin for AuditEvent
impl UnwindSafe for AuditEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.