Enterprise-grade Rust Logging Infrastructure
β¨ Features β’ π Quick Start β’ π Documentation β’ π» Examples β’ π€ Contributing
Inklog provides a comprehensive logging solution for enterprise applications:
| β‘ High Performance | π Security First | π Multi-Target | π Observability |
|---|---|---|---|
| Async I/O with Tokio | AES-256-GCM encryption | Console, File, DB, S3 | Health monitoring |
| Batch writes & compression | Zeroized secret memory | Automatic rotation | Metrics & tracing |
use inklog::{InklogConfig, LoggerManager};
use std::path::PathBuf;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = InklogConfig {
file_sink: Some(inklog::FileSinkConfig {
enabled: true,
path: "logs/app.log".into(),
max_size: "100MB".into(),
compress: true,
..Default::default()
}),
..Default::default()
};
let _logger = LoggerManager::with_config(config).await?;
log::info!("Application started successfully");
log::error!("Something went wrong with error details");
Ok(())
}π Table of Contents (Click to expand)
| π― Core Features | β‘ Enterprise Features |
|---|---|
| Always Available | Optional |
|
|
| Preset | Features | Use Case |
|---|---|---|
| minimal | No optional features | Core logging only |
| standard | http, cli |
Standard development setup |
| full | All default features | Production-ready logging |
Add this to your Cargo.toml:
[dependencies]
inklog = "0.1"For full feature set:
[dependencies]
inklog = { version = "0.1", features = ["default"] }|
Step 1: Initialize Logger use inklog::LoggerManager;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let _logger = LoggerManager::new().await?;
log::info!("Logger initialized");
Ok(())
} |
Step 2: Log Messages use inklog::LoggerManager;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let _logger = LoggerManager::new().await?;
log::trace!("Trace message");
log::debug!("Debug message");
log::info!("Info message");
log::warn!("Warning message");
log::error!("Error message");
Ok(())
} |
|
Step 3: File Logging use inklog::{FileSinkConfig, InklogConfig, LoggerManager};
let config = InklogConfig {
file_sink: Some(FileSinkConfig {
enabled: true,
path: "logs/app.log".into(),
max_size: "10MB".into(),
rotation_time: "daily".into(),
keep_files: 7,
compress: true,
..Default::default()
}),
..Default::default()
};
let _logger = LoggerManager::with_config(config).await?; |
Step 4: Database Logging use inklog::{DatabaseSinkConfig, InklogConfig, config::DatabaseDriver};
let config = InklogConfig {
database_sink: Some(DatabaseSinkConfig {
enabled: true,
driver: DatabaseDriver::SQLite,
url: "sqlite://logs/app.db".to_string(),
pool_size: 5,
batch_size: 100,
flush_interval_ms: 1000,
..Default::default()
}),
..Default::default()
};
let _logger = LoggerManager::with_config(config).await?; |
use inklog::{FileSinkConfig, InklogConfig};
// Set encryption key from environment
std::env::set_var("INKLOG_ENCRYPTION_KEY", "base64-encoded-32-byte-key");
let config = InklogConfig {
file_sink: Some(FileSinkConfig {
enabled: true,
path: "logs/encrypted.log.enc".into(),
max_size: "10MB".into(),
encrypt: true,
encryption_key_env: Some("INKLOG_ENCRYPTION_KEY".into()),
compress: false, // Don't compress encrypted logs
..Default::default()
}),
..Default::default()
};
let _logger = LoggerManager::with_config(config).await?;use inklog::{InklogConfig, S3ArchiveConfig};
let config = InklogConfig {
s3_archive: Some(S3ArchiveConfig {
enabled: true,
bucket: "my-log-bucket".to_string(),
region: "us-west-2".to_string(),
archive_interval_days: 7,
local_retention_days: 30,
prefix: "logs/".to_string(),
compression: inklog::archive::CompressionType::Zstd,
..Default::default()
}),
..Default::default()
};
let manager = LoggerManager::with_config(config).await?;
manager.start_archive_service().await?;use inklog::{InklogConfig, config::GlobalConfig};
let format_string = "[{timestamp}] [{level:>5}] {target} - {message} | {file}:{line}";
let config = InklogConfig {
global: GlobalConfig {
level: "debug".into(),
format: format_string.to_string(),
masking_enabled: true,
..Default::default()
},
..Default::default()
};
let _logger = LoggerManager::with_config(config).await?;inklog = "0.1" # Includes: aws, http, cli# Cloud & Storage
inklog = { version = "0.1", features = [
"aws", # AWS S3 archive support
] }
# HTTP Server
inklog = { version = "0.1", features = [
"http", # Axum HTTP health endpoint
] }
# CLI Tools
inklog = { version = "0.1", features = [
"cli", # decrypt, generate, validate commands
] }
# Configuration
inklog = { version = "0.1", features = [
"confers", # TOML configuration support
] }
# Development
inklog = { version = "0.1", features = [
"test-local", # Local testing mode
"debug", # Additional security audit logging
] }| Feature | Dependencies | Description |
|---|---|---|
| aws | aws-sdk-s3, aws-config, aws-types | AWS S3 cloud archive |
| http | axum | HTTP health check endpoint |
| cli | clap, glob, toml | Command-line utilities |
| confers | confers, toml | External TOML configuration support |
| test-local | - | Local testing mode |
| debug | - | Security audit logging |
|
π API Reference
Complete API docs |
π» Examples
Working code examples |
π Guides
In-depth guides |
| Resource | Description |
|---|---|
| π API Reference | Complete API documentation on docs.rs |
| ποΈ Architecture | System architecture and design decisions |
| π Security | Security best practices and features |
| π¦ Examples | Working code examples for all features |
use inklog::LoggerManager;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let _logger = LoggerManager::new().await?;
log::info!("Application started");
log::error!("An error occurred: {}", err);
Ok(())
} |
use inklog::{FileSinkConfig, InklogConfig, LoggerManager};
let config = InklogConfig {
file_sink: Some(FileSinkConfig {
enabled: true,
path: "logs/app.log".into(),
max_size: "10MB".into(),
rotation_time: "daily".into(),
keep_files: 7,
compress: true,
..Default::default()
}),
..Default::default()
};
let _logger = LoggerManager::with_config(config).await?; |
use inklog::{FileSinkConfig, InklogConfig};
std::env::set_var("INKLOG_ENCRYPTION_KEY", "base64-encoded-key");
let config = InklogConfig {
file_sink: Some(FileSinkConfig {
enabled: true,
path: "logs/encrypted.log".into(),
encrypt: true,
encryption_key_env: Some("INKLOG_ENCRYPTION_KEY".into()),
..Default::default()
}),
..Default::default()
};
let _logger = LoggerManager::with_config(config).await?; |
use inklog::{DatabaseSinkConfig, InklogConfig, config::DatabaseDriver};
let config = InklogConfig {
database_sink: Some(DatabaseSinkConfig {
enabled: true,
driver: DatabaseDriver::PostgreSQL,
url: "postgresql://localhost/logs".to_string(),
pool_size: 10,
batch_size: 100,
flush_interval_ms: 1000,
..Default::default()
}),
..Default::default()
};
let _logger = LoggerManager::with_config(config).await?; |
use inklog::{InklogConfig, S3ArchiveConfig};
let config = InklogConfig {
s3_archive: Some(S3ArchiveConfig {
enabled: true,
bucket: "my-log-bucket".to_string(),
region: "us-west-2".to_string(),
archive_interval_days: 7,
local_retention_days: 30,
prefix: "logs/".to_string(),
compression: inklog::archive::CompressionType::Zstd,
..Default::default()
}),
..Default::default()
};
let manager = LoggerManager::with_config(config).await?;
manager.start_archive_service().await?; |
use axum::{routing::get, Json, Router};
use inklog::LoggerManager;
use std::sync::Arc;
let logger = Arc::new(LoggerManager::new().await?);
let app = Router::new().route(
"/health",
get({
let logger = logger.clone();
|| async move { Json(logger.get_health_status()) }
}),
);
// Start HTTP server... |
use inklog::{InklogConfig, config::GlobalConfig};
let format_string = "[{timestamp}] [{level:>5}] {target} - {message}";
let config = InklogConfig {
global: GlobalConfig {
level: "debug".into(),
format: format_string.to_string(),
masking_enabled: true,
..Default::default()
},
..Default::default()
};
let _logger = LoggerManager::with_config(config).await?; |
use inklog::{InklogConfig, config::GlobalConfig};
let config = InklogConfig {
global: GlobalConfig {
level: "info".into(),
format: "{timestamp} {level} {message}".to_string(),
masking_enabled: true, // Enable PII masking
..Default::default()
},
..Default::default()
};
let _logger = LoggerManager::with_config(config).await?;
// Sensitive data will be automatically masked
log::info!("User email: user@example.com");
// Output: User email: ***@***.*** |
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β Application Layer β
β (Your code using log! macros) β
ββββββββββββββββββ¬βββββββββββββββββββββββββββββ
β
ββββββββββββββββββΌβββββββββββββββββββββββββββββ
β Inklog API Layer β
β - LoggerManager, LoggerBuilder β
β - Configuration management β
β - Health monitoring β
ββββββββββββββββββ¬βββββββββββββββββββββββββββββ
β
ββββββββββββββββββΌβββββββββββββββββββββββββββββ
β Sink Abstraction Layer β
β - ConsoleSink β
β - FileSink (rotation, compression) β
β - DatabaseSink (batch writes) β
β - AsyncFileSink β
β - RingBufferedFileSink β
ββββββββββββββββββ¬βββββββββββββββββββββββββββββ
β
ββββββββββββββββββΌβββββββββββββββββββββββββββββ
β Core Processing Layer β
β - Log formatting & templates β
β - Data masking (PII redaction) β
β - Encryption (AES-256-GCM) β
β - Compression (ZSTD, GZIP, Brotli) β
ββββββββββββββββββ¬βββββββββββββββββββββββββββββ
β
ββββββββββββββββββΌβββββββββββββββββββββββββββββ
β Concurrency & I/O β
β - Tokio async runtime β
β - Crossbeam channels β
β - Rayon parallel processing β
ββββββββββββββββββ¬βββββββββββββββββββββββββββββ
β
ββββββββββββββββββΌβββββββββββββββββββββββββββββ
β Storage & External Services β
β - Filesystem β
β - Database (PostgreSQL, MySQL, SQLite) β
β - AWS S3 (cloud archive) β
β - Parquet (analytics) β
βββββββββββββββββββββββββββββββββββββββββββββ
Application Layer
- Application code uses standard
log!macros from thelogcrate - Compatible with existing Rust logging patterns
Inklog API Layer
LoggerManager: Main orchestrator for all logging operationsLoggerBuilder: Fluent builder pattern for configuration- Health status tracking and metrics collection
Sink Abstraction Layer
- Multiple sink implementations for different output targets
- Console output for development
- File output with rotation, compression, and encryption
- Database output with batch writes (PostgreSQL, MySQL, SQLite)
- Async and buffered file sinks for high-throughput scenarios
Core Processing Layer
- Template-based log formatting
- Regex-based PII data masking (emails, SSNs, credit cards)
- AES-256-GCM encryption for sensitive logs
- Multiple compression algorithms (ZSTD, GZIP, Brotli, LZ4)
Concurrency & I/O Layer
- Tokio async runtime for non-blocking I/O
- Crossbeam channels for inter-task communication
- Rayon for CPU-intensive parallel processing
Storage & External Services Layer
- Local filesystem access
- Database connectivity via Sea-ORM
- AWS S3 integration for cloud archival
- Parquet format for analytics workflows
Inklog is built with security as a top priority:
- AES-256-GCM: Military-grade encryption for log files
- Key Management: Environment variable-based key injection
- Zeroized Memory: Secrets are securely cleared after use via
zeroizecrate - SHA-256 Hashing: Integrity verification for encrypted logs
- Regex-Based Patterns: Automatic PII detection and redaction
- Email Masking:
user@example.comβ***@***.*** - SSN Masking: Credit card and social security number redaction
- Custom Patterns: Configurable regex patterns for sensitive data
// Set encryption key securely from environment
std::env::set_var("INKLOG_ENCRYPTION_KEY", "base64-encoded-32-byte-key");
// Key is automatically zeroized after use
// Never hardcode keys in your application- No hardcoded secrets: Keys loaded from environment variables
- Minimal privileged operations: Only necessary file/database access
- Audit logging: Debug feature for security audit trails
- Compliance-ready: Supports GDPR, HIPAA, PCI-DSS logging requirements
# Run all tests with default features
cargo test --all-features
# Run tests with specific features
cargo test --features "aws,http,cli"
# Run tests in release mode
cargo test --release
# Run benchmarks
cargo benchInklog targets 95%+ code coverage:
# Generate coverage report
cargo tarpaulin --out Html --all-features# Format code
cargo fmt --all
# Check formatting without changes
cargo fmt --all -- --check
# Run Clippy (warnings as errors)
cargo clippy --all-targets --all-features -- -D warnings# Run cargo deny for security checks
cargo deny check
# Check for advisories
cargo deny check advisories
# Check for banned licenses
cargo deny check bans# Run integration tests
cargo test --test '*'
# Run with Docker services (PostgreSQL, MySQL)
docker-compose up -d
cargo test --all-features
docker-compose downContributions are welcome! Please see CONTRIBUTING.md for guidelines.
# Clone repository
git clone https://github.com/Kirky-X/inklog.git
cd inklog
# Install pre-commit hooks (if available)
./scripts/install-pre-commit.sh
# Run tests
cargo test --all-features
# Run linter
cargo clippy --all-features
# Format code
cargo fmt --all- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests and ensure all pass (
cargo test --all-features) - Run clippy and fix warnings (
cargo clippy --all-features) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow Rust naming conventions (snake_case for variables, PascalCase for types)
- Use
thiserrorfor error types - Use
anyhowfor error contexts - Add doc comments to all public APIs
- Run
cargo fmtbefore committing
Inklog wouldn't be possible without these amazing projects:
- tracing - The foundation of Rust structured logging
- tokio - Async runtime for Rust
- Sea-ORM - Async ORM for database operations
- AWS SDK for Rust - AWS S3 integration
- axum - Web framework for HTTP endpoints
- serde - Serialization framework
- The entire Rust ecosystem for amazing tools and libraries
|
π Issues
Report bugs and issues |
π¬ Discussions
Ask questions and share ideas |
π GitHub
View source code |
If you find this project useful, please consider giving it a βοΈ!
Built with β€οΈ by Inklog Team
Β© 2026 Inklog Project. All rights reserved.