Skip to content

Repository files navigation

Log Classification System

Business Context

KOHO is a company that builds a suite of software products (CRM, Billing System, HR Software, etc.) for various clients. Each product generates log files containing valuable information about system operations, warnings, errors, and other events.

Current Problems

Currently, KOHO lacks a log monitoring and alerting system. This leads to:

  • Delays in detecting issues
  • Operational inefficiency
  • Weaker security

For example, if a server crashes and logs an exception, there is no automated feedback or alerting mechanism. As a result, issues are detected late, and responses are reactive rather than proactive.

Business Solution

Log Classification System is the first step towards building a comprehensive log monitoring solution. This system will:

  • Aggregate logs from various KOHO products and clients.
  • Classify log entries (e.g., Info, Warning, Error, Critical).
  • Enable downstream systems to trigger alerts and automate responses based on log severity and type.

Business Features

  • Log Aggregation: Collect logs from multiple products and clients (Done by the Data Engineering Team)
  • Log Classification: Automatically categorize log entries by severity and type
  • Extensible: Designed to integrate with future log monitoring and alerting systems

Technical Implementation

Classification Approaches

  1. Regular Expression (Regex)

    • Handles predictable patterns
    • Fast and rule-based classification
    • Ideal for standardized log formats
  2. Sentence Transformer + Logistic Regression

    • Processes complex patterns with sufficient training data
    • Uses advanced NLP embeddings
    • Machine learning-based classification
  3. LLM (Large Language Models)

    • Handles edge cases and complex patterns
    • Useful when labeled data is limited
    • Provides fallback classification mechanism

architecture

Folder Structure

  1. training/:

    • Contains the code for training models using Sentence Transformer and Logistic Regression.
    • Includes the code for regex-based classification.
  2. models/:

    • Stores the saved models, including Sentence Transformer embeddings and the Logistic Regression model.
  3. resources/:

    • This folder contains resource files such as test CSV files, output files, images, etc.
  4. Root Directory:

    • Contains the FastAPI server code (server.py).

Setup Instructions

  1. Prerequisites

    • Python 3.11 or higher
    • pip package manager
  2. Installation

    git clone https://github.com/yourusername/Log-Classification.git
    cd Log-Classification
    pip install -r requirements.txt
  3. Running the Server

    uvicorn server:app --reload

    Access points:

Usage

  1. Prepare CSV file with columns:

    • source
    • log_message
  2. Example input/output:

    source,log_message,target_label
    ModernCRM,"IP 192.168.133.114 blocked",Security Alert
    BillingSystem,"User 12345 logged in.",User Action

About

This project implements a hybrid log classification system for KOHO's software products, combining regex patterns, sentence transformers, and LLMs to automatically categorize log entries by severity and type. The system processes logs from various sources (CRM, Billing, HR) and enables automated monitoring and alerting based on log classifications.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages