Skip to main content

🧠 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! 🧠

Metadata

Release files for logbrain 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for logbrain 0.1.2
File Size Uploaded Provenance Actions
logbrain-0.1.2.tar.gz 4.8 kB Without provenance Details for logbrain-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for logbrain 0.1.2
File Interpreter ABI Platform Actions
logbrain-0.1.2-py3-none-any.whl Python 3 none any Details for logbrain-0.1.2-py3-none-any.whl

Total release size: 10.3 kB

Release files / logbrain-0.1.2.tar.gz

Download URL logbrain-0.1.2.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
41294a126724f9edddd53b9cf494670df73cbc84859eaa985b1f65d3893d7361
BLAKE2b-256 checksum
How to use checksums
ed95f6b604147850715a0d8df8ae484fad2f2f26ecbbca06a17a5009d546538b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.12

Release files / logbrain-0.1.2-py3-none-any.whl

Download URL logbrain-0.1.2-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8750be92f413149d4c10e1ee7998c1e17bf315226d259c7c214314b634e34dbd
BLAKE2b-256 checksum
How to use checksums
a4343a8ddc2c5cb4cab4224ea403b8a67391fbecb97af43363e34d4db5965ef3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.12

Security for logbrain 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page