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.

📝 License

This project is licensed under the MIT License. See LICENSE for full details.

💻 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.2.tar.gz (4.8 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.2-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: logbrain-0.1.2.tar.gz
  • Upload date:
  • Size: 4.8 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.2.tar.gz
Algorithm Hash digest
SHA256 41294a126724f9edddd53b9cf494670df73cbc84859eaa985b1f65d3893d7361
MD5 fd21241428901ba214784f3d3591a0ac
BLAKE2b-256 ed95f6b604147850715a0d8df8ae484fad2f2f26ecbbca06a17a5009d546538b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: logbrain-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.5 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8750be92f413149d4c10e1ee7998c1e17bf315226d259c7c214314b634e34dbd
MD5 04f1c4ace690d925421adb5ed1f7910b
BLAKE2b-256 a4343a8ddc2c5cb4cab4224ea403b8a67391fbecb97af43363e34d4db5965ef3

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