logarithm
Logarithm: Anomaly Detection Agent
Logarithm is a self-learning diagnostics agent for GNU/Linux systems that uses unsupervised machine learning to detect anomalies in system logs in real-time.
Built with Crystal for bare-metal performance, memory safety, and native multithreading, Logarithm trains neural autoencoders and linear support vector machines (SVM) on normal log baselines to identify potential regressions, zero-day threats, and unusual system behaviors without requiring labeled datasets or heavy external dependencies.
Key Features
| Capability | Architecture | Description |
|---|---|---|
| π‘ Multi-Source Ingestion | JournaldLogSource / VarlogLogSource |
Simultaneous streaming from systemd-journald, syslog files, and piped standard input (stdin). |
| π§ Unsupervised ML Engine | Neural Autoencoder & One-Class SVM | Real-time reconstruction error scoring with Adam optimization and hyper-plane boundary classification. |
| β‘ Bare-Metal Concurrency | Execution Contexts & Sync::Mutex |
Non-blocking CSP channels and multithreaded worker pools delivering sub-millisecond inference latency. |
| πΎ Bounded Memory Footprint | ChunkedTrainingStorage |
File-backed batch rotation preserving $<50,\text{MB}$ RAM during training on datasets exceeding 100K+ logs. |
| π At-Rest Security | AES-256-CBC & HMAC Verification | Encrypted model serialization with cryptographic tampering detection and structured audit logging. |
| π‘οΈ Self-Healing Resilience | Circuit Breakers & Health Probes | Active health checks, exponential retry policies, and performance threshold monitors. |
| π§ͺ Synthetic Simulation Suite | fakelogs & Automated Demos |
Built-in synthetic log generator with configurable anomaly ratios and reproducible simulation scripts. |
Quick Start
1. Build
git clone https://gitlab.com/renich/logarithm.git
cd logarithm
make setup
make release
2. Train
# Train on systemd journal for 1 hour
bin/logarithm train -j -t '1h'
# Train on flat log files
bin/logarithm train /var/log/syslog /var/log/messages -t '2h'
3. Monitor
# Monitor systemd journal in real-time
bin/logarithm monitor -j
# Monitor specific files with custom sensitivity threshold
bin/logarithm monitor -T 0.85 /var/log/secure
# Monitor piped input stream
tail -f /var/log/app.log | bin/logarithm monitor -i
Documentation
Comprehensive engineering, architectural, and operational manuals are available in docs/:
- π User Guide & Manual β Operator guides, deployment strategies, and runtime options.
- π Quickstart Guide β Step-by-step setup, training, and real-time monitoring walk-throughs.
- π§ͺ Fakelogs & Testing Guide β Generating synthetic logs, injecting anomalies, and running simulations.
- π Functional Specifications β Modular requirements (
[FUNC-xxx]), ingestion modes, and ML behaviors. - ποΈ Technical Specifications β Internal subsystems (
[TECH-xxx]), concurrency model, and storage engine. - βοΈ API & CLI Reference β Complete CLI flag catalog, YAML configuration schemas, and output formats.
- ποΈ Architecture Decision Records β Architectural choices, trade-offs, and historical context.
- πΊοΈ Project Roadmap β Phased roadmap tracking and milestone definitions.
Development & Verification
Logarithm enforces a zero-defect quality gate across all subsystems:
make check # Run full verification suite (specs, Ameba, Flaw SAST, crstlint)
make test # Run 193-spec unit & property test suite
make lint # Run Ameba static analysis and Flaw security scanner
make doc-check # Verify reStructuredText formatting and syntax
make coverage # Generate kcov test coverage report
Automated Simulations
/usr/bin/bash demo/demo_anomaly_detection.bash # End-to-end anomaly detection pipeline demo
/usr/bin/bash demo/demo_chunked_training.bash # Chunked storage & memory-efficient training demo
/usr/bin/bash integration/test.bash # Integration test suite
/usr/bin/bash benchmark/profile.bash # Throughput profiling suite
License & Authors
- Software: GNU General Public License v3.0 (GPLv3)
- Documentation: GNU Free Documentation License v1.3 (GFDL)
- Code of Honor: Contributor standards defined in CODE_OF_HONOR.rst
- Author: RΓ©nich Bon ΔiriΔ
<renich@woralelandia.com>| woralelandia.com | EVALinux
Support & Donations
If you find Logarithm useful and wish to support its ongoing development, please consider donating:
logarithm
- 0
- 0
- 0
- 0
- 4
- 9 days ago
- September 14, 2025
GNU General Public License v3.0 or later
Wed, 09 Sep 2026 13:21:38 GMT