Skip to content

Secure, cryptographically chained logging system in Python

License

Notifications You must be signed in to change notification settings

damienos61/viraxlog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

πŸ›‘οΈ ViraxLog

GitHub license Python Version Build Status Coverage Status

ViraxLog is a high-security logging system designed to guarantee full integrity of your event logs. Using cryptographic chaining (Blockchain-style), each entry is linked to the previous one, making any modification or deletion detectable.


✨ Key Features

Feature Description
πŸ”— Cryptographic Chaining Each log contains the SHA-256 hash of the previous entry, ensuring full integrity.
⚑ Asynchronous & High Performance Uses a queue and worker thread to never block your main application.
πŸ“¦ Batch Writing Optimized SQLite writes in configurable batches to reduce disk I/O.
πŸ” Built-in Audit Native tools to verify database integrity and detect chain breaks.
πŸ–₯️ CLI Interface Ready-to-use commands to initialize, view, and monitor logs.
πŸ› οΈ Watchers System monitoring (CPU, RAM, Heartbeat) integrated directly into the log stream.
πŸ”’ Security Designed to resist tampering and ensure authenticity of log data.

πŸš€ Installation

Development Mode (Editable)

Clone the repository and install the project with dependencies:

git clone https://github.com/damienos61/viraxlog.git
cd viraxlog
pip install -e .

Installing Development Tools

pip install -e ".[dev]"

πŸ“– Quick Usage

from viraxlog.core import ViraxLogger
from viraxlog.models import ViraxConfig

# 1. Custom Configuration
config = ViraxConfig(
    db_name="secure_logs.db",
    batch_size=10  # Writes to DB every 10 messages
)

# 2. Initialize Logger
logger = ViraxLogger(config)

# 3. Log Events
logger.log("INFO", "AUTH", "Admin user logged in")
logger.log("WARNING", "SYSTEM", "High CPU temperature", data={"temp": 75})

# 4. Graceful Shutdown (flush remaining logs)
logger.shutdown()

πŸ›‘οΈ Integrity Verification

Check that no one has tampered with your SQLite logs:

from viraxlog.audit import AuditManager

auditor = AuditManager("secure_logs.db")
is_valid, error_report = auditor.verify_chain()

if is_valid:
    print("βœ… Integrity confirmed: No log entries were altered.")
else:
    print(f"❌ Corruption alert: Issue detected at index {error_report}")

πŸ§ͺ Tests

The project comes with a complete unit test suite covering cryptography, database, and async engine.

pytest

Expected result: 12 passed


πŸ“‚ Project Structure

File Description
src/viraxlog/core.py Main engine, async thread handling.
src/viraxlog/database.py SQLite persistence manager.
src/viraxlog/audit.py Verification and security audit logic.
src/viraxlog/utils/crypto.py SHA-256 hashing functions.
src/viraxlog/utils/helpers.py Utility functions (sanitization, formatting).
src/viraxlog/watchers.py System monitoring sensors.
src/viraxlog/interface.py Simplified facade, global singleton, logging helpers.
src/viraxlog/viewer.py CLI to view logs in real-time.

πŸ‘€ Author

damienos61 GitHub: @damienos61


πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.