๐ฏ A high-performance, secure, and feature-rich logging infrastructure built on Tokio
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 ;
use PathBuf;
async
๐ Table of Contents
- โจ Features
- ๐ Quick Start
- ๐จ Feature Flags
- ๐ Documentation
- ๐ป Examples
- ๐๏ธ Architecture
- ๐ Security
- ๐งช Testing
- ๐ค Contributing
- ๐ License
- ๐ Acknowledgments
โจ Features
| ๐ฏ Core Features | โก Enterprise Features |
|---|---|
| Always Available | Optional |
๐ฏ Core Features (Always Available)
| Status | Feature | Description |
|---|---|---|
| โ | Async I/O | Tokio-powered non-blocking logging |
| โ | Multi-Target Output | Console, file, database, custom sinks |
| โ | Structured Logging | tracing ecosystem integration |
| โ | Custom Formatting | Template-based log format |
| โ | File Rotation | Size-based and time-based rotation |
| โ | Data Masking | Regex-based PII redaction |
| โ | Health Monitoring | Sink status and metrics tracking |
| โ | CLI Tools | decrypt, generate, validate commands |
โก Enterprise Features
| Status | Feature | Description |
|---|---|---|
| ๐ | Compression | ZSTD, GZIP, Brotli, LZ4 support (zstd, flate2, etc.) |
| ๐ | Encryption | AES-256-GCM file encryption (aes-gcm) |
| ๐๏ธ | Database Sink | PostgreSQL, MySQL, SQLite via Sea-ORM |
| โ๏ธ | S3 Archive | Cloud log archival with AWS SDK S3 (aws feature) |
| ๐ | Parquet Export | Analytics-ready log format (parquet feature) |
| ๐ | HTTP Endpoint | Axum-based health check server (http feature) |
| ๐ | Scheduled Tasks | Cron-based archive scheduling |
| ๐ง | CLI Tools | Utility commands for log management (cli feature) |
| ๐ | TOML Config | External configuration support (confers feature) |
๐ฆ Feature Presets
| Preset | Features | Use Case |
|---|---|---|
| minimal | No optional features | Core logging only |
| standard | http, cli |
Standard development setup |
| full | All default features | Production-ready logging |
๐ Quick Start
๐ฆ Installation
Add this to your Cargo.toml:
[]
= "0.1"
For full feature set:
[]
= { = "0.1", = ["default"] }
๐ก Basic Usage
๐ฌ 5-Minute Quick Start
Step 1: Initialize Logger
use LoggerManager;
async
Step 2: Log Messages
use LoggerManager;
async
Step 3: File Logging
use ;
let config = InklogConfig ;
let _logger = with_config.await?;
Step 4: Database Logging
use ;
let config = InklogConfig ;
let _logger = with_config.await?;
๐ง Advanced Configuration
Encrypted File Logging
use ;
// Set encryption key from environment
set_var;
let config = InklogConfig ;
let _logger = with_config.await?;
S3 Cloud Archiving
use ;
let config = InklogConfig ;
let manager = with_config.await?;
manager.start_archive_service.await?;
Custom Log Format
use ;
let format_string = "[{timestamp}] [{level:>5}] {target} - {message} | {file}:{line}";
let config = InklogConfig ;
let _logger = with_config.await?;
๐จ Feature Flags
Default Features
= "0.1" # Includes: aws, http, cli
Optional Features
# Cloud & Storage
= { = "0.1", = [
"aws", # AWS S3 archive support
] }
# HTTP Server
= { = "0.1", = [
"http", # Axum HTTP health endpoint
] }
# CLI Tools
= { = "0.1", = [
"cli", # decrypt, generate, validate commands
] }
# Configuration
= { = "0.1", = [
"confers", # TOML configuration support
] }
# Development
= { = "0.1", = [
"test-local", # Local testing mode
"debug", # Additional security audit logging
] }
Feature Details
| 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 |
๐ Documentation
๐ Additional Resources
| 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 |
๐ป Examples
๐ก Real-world Examples
๐ Basic Logging
use LoggerManager;
async
๐ File Logging with Rotation
use ;
let config = InklogConfig ;
let _logger = with_config.await?;
๐ Encrypted Logging
use ;
set_var;
let config = InklogConfig ;
let _logger = with_config.await?;
๐๏ธ Database Logging
use ;
let config = InklogConfig ;
let _logger = with_config.await?;
โ๏ธ S3 Cloud Archive
use ;
let config = InklogConfig ;
let manager = with_config.await?;
manager.start_archive_service.await?;
๐ฅ HTTP Health Endpoint
use ;
use LoggerManager;
use Arc;
let logger = new;
let app = new.route;
// Start HTTP server...
๐จ Custom Format
use ;
let format_string = "[{timestamp}] [{level:>5}] {target} - {message}";
let config = InklogConfig ;
let _logger = with_config.await?;
๐ Data Masking
use ;
let config = InklogConfig ;
let _logger = with_config.await?;
// Sensitive data will be automatically masked
info!;
// Output: User email: ***@***.***
๐๏ธ Architecture
๐๏ธ System Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 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) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Layer-by-Layer Explanation
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
๐ Security
๐ก๏ธ Security Features
Inklog is built with security as a top priority:
๐ Encryption
- 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
๐ญ Data Masking
- 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
๐ Secure Key Handling
// Set encryption key securely from environment
set_var;
// Key is automatically zeroized after use
// Never hardcode keys in your application
๐ก๏ธ Security Best Practices
- 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
๐งช Testing
๐ฏ Run Tests
# Run all tests with default features
# Run tests with specific features
# Run tests in release mode
# Run benchmarks
Test Coverage
Inklog targets 95%+ code coverage:
# Generate coverage report
Linting and Formatting
# Format code
# Check formatting without changes
# Run Clippy (warnings as errors)
Security Audit
# Run cargo deny for security checks
# Check for advisories
# Check for banned licenses
Integration Tests
# Run integration tests
# Run with Docker services (PostgreSQL, MySQL)
๐ค Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Development Setup
# Clone repository
# Install pre-commit hooks (if available)
# Run tests
# Run linter
# Format code
Pull Request Process
- 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
Code Style
- 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
๐ License
This project is dual-licensed under MIT / Apache-2.0:
๐ Acknowledgments
๐ Built on Excellent Tools
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
๐ Support
โญ Star History
๐ Support This Project
If you find this project useful, please consider giving it a โญ๏ธ!
Built with โค๏ธ by Inklog Team
ยฉ 2026 Inklog Project. All rights reserved.