Skip to main content

Log using LLM AI to search for build/test failures and provide ideas for fixing these.

Project description

Log Detective

A Python tool to analyze logs using a Language Model (LLM) and Drain template miner.

Installation

# optionaly when you prefer system packages
dnf install python3-jsonpickle python3-tiktoken
# install all remaining packages
pip install .

Usage

To analyze a log file, run the script with the following command line arguments:

  • url (required): The URL of the log file to be analyzed.
  • --model (optional, default: "Mistral-7B-Instruct-v0.2-GGUF"): The path or URL of the language model for analysis.
  • --summarizer (optional, default: "drain"): Choose between LLM and Drain template miner as the log summarizer. You can also provide the path to an existing language model file instead of using a URL.
  • --n_lines (optional, default: 5): The number of lines per chunk for LLM analysis. This only makes sense when you are summarizing with LLM.

Example usage:

~/.local/bin/logdetective https://example.com/logs.txt

Contributing

Contributions are welcome! Please submit a pull request if you have any improvements or new features to add. Make sure your changes pass all existing tests before submitting.

To develop logdetective, you should fork this repository, clone your fork, and install dependencies using pip:

git clone https://github.com/yourusername/logdetective.git
cd logdetective
pip install .

Make changes to the code as needed and run pre-commit.

Tests

The tox is used to manage tests. Please install tox package into your distribution and run:

tox

This will create a virtual environment with dependencies and run all the tests. For more information follow the tox help.

To run only a specific test execute this:

tox run -e style # to run flake8

or

tox run -e lint # to run pylint

License

This project is licensed under the Apache-2.0 License - see the LICENSE file for details.

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

logdetective-0.2.0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

logdetective-0.2.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file logdetective-0.2.0.tar.gz.

File metadata

  • Download URL: logdetective-0.2.0.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.3 Linux/6.8.8-300.fc40.x86_64

File hashes

Hashes for logdetective-0.2.0.tar.gz
Algorithm Hash digest
SHA256 547c3c4e4c6edd4ef2362f63456f6634ffd3a24c20c3427f531d31d657ae4fe7
MD5 3d4510ca29881ebcfe00f41472730206
BLAKE2b-256 7b6dcd2c0afc512a91220fae1f387c5e94356a1a805b5230ae1fde5744cc8846

See more details on using hashes here.

File details

Details for the file logdetective-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: logdetective-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.3 Linux/6.8.8-300.fc40.x86_64

File hashes

Hashes for logdetective-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 665d1b5c86e5e1bdf7cda80c8d3d2d7545523e51cd9f4b03ca4f2da2c986e620
MD5 5245b677092b47557e0440f9ce88138d
BLAKE2b-256 685c40d8de83dbbf00b4964f4e4276a24797f16725dd9888ecdb33ef588ed00e

See more details on using hashes here.

Supported by

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