Skip to main content

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 .txt file 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 logic
  • pattern_config.json: Configurable pattern matching
  • story.txt: Sample flow for CognitiveGraph
  • test_logbrain.py: Test case
  • setup.py, requirements.txt: Packaging

📦 Install & Run

pip install -r requirements.txt
python test_logbrain.py

Ready to log with brains! 🧠

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

logbrain-0.1.1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

logbrain-0.1.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file logbrain-0.1.1.tar.gz.

File metadata

  • Download URL: logbrain-0.1.1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.12

File hashes

Hashes for logbrain-0.1.1.tar.gz
Algorithm Hash digest
SHA256 db6ccd5da35e9df7407804457452c91a644de8166d2b629f4797c6be239c446b
MD5 5f8ef8f1cc7306c7774a32590d011d36
BLAKE2b-256 fc534c61703f62c8bf80a37426e4001ce44d48dac196b4e73641cabf9bea01cf

See more details on using hashes here.

File details

Details for the file logbrain-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: logbrain-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.12

File hashes

Hashes for logbrain-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a7b3c0f995d5fa7255d2f069fd88698ef13272427a11cd1edcd033795b0b0dde
MD5 03399605f6211988fb083e7f5a6cf7f2
BLAKE2b-256 57049464b9e1a3d45468b43cc4e568c58b8938791c9d9980979b6b51c2bb9d90

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page