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.
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.
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.
- 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
-
Regular Expression (Regex)
- Handles predictable patterns
- Fast and rule-based classification
- Ideal for standardized log formats
-
Sentence Transformer + Logistic Regression
- Processes complex patterns with sufficient training data
- Uses advanced NLP embeddings
- Machine learning-based classification
-
LLM (Large Language Models)
- Handles edge cases and complex patterns
- Useful when labeled data is limited
- Provides fallback classification mechanism
-
training/:- Contains the code for training models using Sentence Transformer and Logistic Regression.
- Includes the code for regex-based classification.
-
models/:- Stores the saved models, including Sentence Transformer embeddings and the Logistic Regression model.
-
resources/:- This folder contains resource files such as test CSV files, output files, images, etc.
-
Root Directory:
- Contains the FastAPI server code (
server.py).
- Contains the FastAPI server code (
-
Prerequisites
- Python 3.11 or higher
- pip package manager
-
Installation
git clone https://github.com/yourusername/Log-Classification.git cd Log-Classification pip install -r requirements.txt -
Running the Server
uvicorn server:app --reload
Access points:
- Main endpoint: http://127.0.0.1:8000/
- Swagger docs: http://127.0.0.1:8000/docs
- ReDoc: http://127.0.0.1:8000/redoc
-
Prepare CSV file with columns:
- source
- log_message
-
Example input/output:
source,log_message,target_label ModernCRM,"IP 192.168.133.114 blocked",Security Alert BillingSystem,"User 12345 logged in.",User Action
