Skip to main content

AI-Log-Analyzer

AI-Log-Analyzer is an open source toolkit, user friendly, based on deep-learning, for unstructured log anomaly detection.

Components

Anomaly Detection: The core of the project.

  1. Log Parsing: Logs are structured using the drain3 tool
  2. Training: An unsupervised LSTM model is trained to learn the normal workflow of a system.
  3. Anomaly Detection: If the model has been trained, it can predict anomalies in log sequences.

You can read the papers about deeplog and loganomaly for further information.

Installation

git clone ...
cd AI-Log-Analyzer
pip3 install -r requirements.txt
python -m spacy download en_core_web_sm

If you have a compatible gpu you can install CUDA. Training a neural network on gpu is way faster than cpu.

Unlike DeepLog, LogAnomaly convert log into semantic vectors. To use it, you need to download a dictionnary that map words into vectors. Bellow the instruction to download word2vec for English:

wget https://dl.fbaipublicfiles.com/fasttext/vectors-crawl/cc.en.300.vec.gz
gunzip cc.en.300.vec.gz

Then run in a python interpreter:

from ailoganalyzer.dataset.dbm_vec import install_vectors
install_vectors("cc.en.300.vec", "en_vec")

To ensure the dictionnary is installed:

with open("en_vec") as d:
    print("hello" in d)
    print(d["hello"])

Quick start

Train the model

from ailoganalyzer.dataset import LogFileDataset
from ailoganalyzer.model import DeepLog, LogAnomaly
from torch.utils.data import DataLoader
import lightning as L

log_file = "path/to/your/logfile.log"
dataset = LogFileDataset(log_file, semantic_vector="en_vec", seq_label=True)

train_dataloader = DataLoader(train_dataset, batch_size=100)

model = LogAnomaly(dataset.get_num_classes(), optimizer_fun="adam")

trainer = L.Trainer(max_epochs=100)
trainer.fit(model=model, train_dataloaders=train_dataloader)

Metadata

Release files for ailoganalyzer 1.0.0

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

Source distribution (sdist)

Source distribution for ailoganalyzer 1.0.0
File Size Uploaded
ailoganalyzer-1.0.0.tar.gz 45.9 kB Details

Built distribution (wheel)

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

Total release size: 80.0 kB

Release files / ailoganalyzer-1.0.0.tar.gz

Download URL ailoganalyzer-1.0.0.tar.gz
Size 45.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ccf42936d6bcd251df31e0574c03f683abdd5efadeae3cf2dcb1bebfbba26919
BLAKE2b-256 checksum
How to use checksums
3a7b124dff597e2c2b16ee975935592324d3954d546f321409c96b51ded23a67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.2

Release files / ailoganalyzer-1.0.0-py3-none-any.whl

Download URL ailoganalyzer-1.0.0-py3-none-any.whl
Size 34.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
196cd393b472d2769f134fe2a475f65944132db84411dd52d62704598e7a281b
BLAKE2b-256 checksum
How to use checksums
36d7422188f12d7b4ee9d64dacddf83fa0f666c21915f900954a1f00c2405a85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.2

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

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