pub struct AuditLogger { /* private fields */ }Expand description
Audit logger
Implementations§
Source§impl AuditLogger
impl AuditLogger
Sourcepub fn new(config: AuditConfig) -> Result<Self>
pub fn new(config: AuditConfig) -> Result<Self>
Create a new audit logger with the given configuration
Sourcepub fn with_default_config() -> Result<Self>
pub fn with_default_config() -> Result<Self>
Create a new audit logger with default configuration
Sourcepub fn log(&self, entry: AuditEntry) -> Result<()>
pub fn log(&self, entry: AuditEntry) -> Result<()>
Log an audit entry
Sourcepub fn log_command(
&self,
command: &str,
args: &[String],
exit_code: Option<i32>,
duration_ms: Option<u64>,
) -> Result<()>
pub fn log_command( &self, command: &str, args: &[String], exit_code: Option<i32>, duration_ms: Option<u64>, ) -> Result<()>
Log a command execution
Sourcepub fn log_config_change(
&self,
key: &str,
old_value: Option<&str>,
new_value: &str,
) -> Result<()>
pub fn log_config_change( &self, key: &str, old_value: Option<&str>, new_value: &str, ) -> Result<()>
Log a configuration change
Sourcepub fn log_security_event(
&self,
message: &str,
severity: AuditSeverity,
) -> Result<()>
pub fn log_security_event( &self, message: &str, severity: AuditSeverity, ) -> Result<()>
Log a security event
Sourcepub fn read_entries(&self) -> Result<Vec<AuditEntry>>
pub fn read_entries(&self) -> Result<Vec<AuditEntry>>
Read all audit entries
Sourcepub fn query_entries(
&self,
event_type: Option<AuditEventType>,
severity: Option<AuditSeverity>,
user: Option<&str>,
since: Option<DateTime<Utc>>,
until: Option<DateTime<Utc>>,
limit: Option<usize>,
) -> Result<Vec<AuditEntry>>
pub fn query_entries( &self, event_type: Option<AuditEventType>, severity: Option<AuditSeverity>, user: Option<&str>, since: Option<DateTime<Utc>>, until: Option<DateTime<Utc>>, limit: Option<usize>, ) -> Result<Vec<AuditEntry>>
Query audit entries with filters
Sourcepub fn get_stats(&self) -> Result<AuditStats>
pub fn get_stats(&self) -> Result<AuditStats>
Get audit statistics
Auto Trait Implementations§
impl Freeze for AuditLogger
impl RefUnwindSafe for AuditLogger
impl Send for AuditLogger
impl Sync for AuditLogger
impl Unpin for AuditLogger
impl UnwindSafe for AuditLogger
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more