LogBrain - Smart log analyzer using symbolic logic and lightweight AI
Project description
🧠 LogBrain
LogBrain is a smart Python log analysis toolkit that merges lightweight machine learning, symbolic reasoning, and story-driven flow graphs. It analyzes logs (text or screenshots), understands their structure, and generates meaningful summaries or problem statements using rule-based or mini-LLM methods.
🧩 Key Components
1. ConfigurablePatternType
- Parses log content using fuzzy logic or ML.
- Can match entries to pre-defined labels like
CRON,APP, etc. - Fully configurable via
pattern_config.json.
2. CognitiveGraph
- Accepts a story (e.g. application flow) as a
.txtfile or LLM-generated text. - Builds a flow map and uses it to detect the stage where errors occur.
📥 Sample Input: Logs
ERROR: cron job failed at 02:30
FAIL: could not execute script
🧠 Sample Summary (Generated via Tiny LLM)
The cron job could not execute the script at 02:30.
This failure likely caused the application timeout due to unmet preconditions.
💻 Usage Example
from logbrain.logbrain import LogBrain
logbrain = LogBrain("pattern_config.json", "story.txt", is_file=True)
lines = ["ERROR: cron job failed at 02:30", "FAIL: could not execute script"]
logbrain.analyze_log("log.txt", lines)
logbrain.finalize(use_llm=True) # Uses mini LLM to build better summary
print(logbrain.summarize())
📁 Files
logbrain.py: Core logicpattern_config.json: Configurable pattern matchingstory.txt: Sample flow for CognitiveGraphtest_logbrain.py: Test casesetup.py,requirements.txt: Packaging
📦 Install & Run
pip install -r requirements.txt
python test_logbrain.py
Ready to log with brains! 🧠
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file logbrain-0.1.0.tar.gz.
File metadata
- Download URL: logbrain-0.1.0.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a006f84c30990107c20b743b0a01b1c0a2fe844579425d0663909b082b5a9fb
|
|
| MD5 |
9a3f8a700bbc9c7b2f4025a041fc66c9
|
|
| BLAKE2b-256 |
0fb93173e3ddd92d2c7d203e48df0b2b0d2976ffb61bb6b58789e0197ca8f280
|
File details
Details for the file logbrain-0.1.0-py3-none-any.whl.
File metadata
- Download URL: logbrain-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f49e49a63762ccca35ee8ddd16403736d3ccc97c9c858798b5db9598ba64256
|
|
| MD5 |
969160058360e962a2c8fa1a8bbe1ebb
|
|
| BLAKE2b-256 |
b53dbbbabf5916f967d5d6776ea775e4c60c8b7ca947219aab594aec2d681690
|