Crate rust_secure_logger

Crate rust_secure_logger 

Source
Expand description

§Rust Secure Logger v2.0

A production-ready, memory-safe logging library for financial systems and critical infrastructure.

§Features

  • Memory Safety: Built with Rust’s ownership system to prevent buffer overflows and memory corruption
  • Thread Safety: Concurrent logging without data races using Arc
  • Cryptographic Integrity: SHA-256/SHA-3 hashing for tamper detection
  • Log Encryption: AES-256-GCM encryption for sensitive log data (v2.0)
  • Log Compression: GZIP compression for efficient storage (v2.0)
  • Log Correlation: Automatic correlation IDs for distributed tracing (v2.0)
  • Rate Limiting: Configurable rate limiting to prevent log flooding (v2.0)
  • Log Redaction: Automatic PII/sensitive data redaction (v2.0)
  • File Persistence: Log rotation and disk persistence
  • SIEM Integration: CEF, LEEF, Syslog, and Splunk HEC formats
  • Compliance Reporting: SOX, GLBA, PCI-DSS, HIPAA automated reports
  • Audit Trail: Immutable log entries with timestamps
  • Metrics: Built-in logging metrics and statistics (v2.0)

§Alignment with Federal Guidance

This library aligns with 2024 CISA/FBI guidance recommending memory-safe languages for critical infrastructure to eliminate 70% of security vulnerabilities.

§Quick Start

use rust_secure_logger::{SecureLogger, LoggerConfig};

// Basic usage
let logger = SecureLogger::new();
logger.info("Application started");
logger.audit("User authentication successful", Some(serde_json::json!({
    "user_id": "12345",
    "ip_address": "192.168.1.100"
})));

// v2.0: With encryption and correlation
let config = LoggerConfig::default()
    .with_encryption(true)
    .with_compression(true)
    .with_correlation_id("trace-12345");
let secure_logger = SecureLogger::with_config(config);

§What’s New in v2.0

  • Encryption: AES-256-GCM encryption for log entries
  • Compression: GZIP compression for storage efficiency
  • Correlation IDs: Distributed tracing support
  • Rate Limiting: Prevent log flooding attacks
  • Redaction: Automatic PII masking
  • HIPAA Compliance: Healthcare compliance reporting
  • Enhanced Metrics: Detailed logging statistics

Re-exports§

pub use compliance::ComplianceFramework;
pub use compliance::ComplianceReport;
pub use compliance::ComplianceReporter;
pub use entry::LogEntry;
pub use entry::SecurityLevel;
pub use formats::CEFFormatter;
pub use formats::LEEFFormatter;
pub use formats::SplunkFormatter;
pub use formats::SyslogFormatter;
pub use persistence::LogWriter;
pub use persistence::PersistenceConfig;
pub use encryption::LogEncryptor;
pub use encryption::EncryptedLogEntry;
pub use redaction::LogRedactor;
pub use redaction::RedactionPattern;
pub use redaction::RedactionConfig;
pub use metrics::LogMetrics;
pub use metrics::MetricsSnapshot;

Modules§

compliance
Compliance reporting for SOX, GLBA, PCI-DSS
encryption
Log encryption module for secure logging v2.0
entry
Log entry structure with cryptographic integrity
formats
SIEM export formats (CEF, LEEF, Syslog)
metrics
Logging metrics module for monitoring v2.0
persistence
Log persistence to disk with rotation and compression
redaction
Log redaction module for PII protection v2.0

Structs§

LogStatistics
Statistics about log entries
LoggerConfig
Logger configuration for v2.0 features
SecureLogger
Thread-safe secure logger for financial systems

Enums§

HashAlgorithm
Hash algorithm selection
LoggerError
Logger errors