Lightweight cloud agent for Windows Event Log anomaly detection
Project description
logwatch-ai
Lightweight cloud agent for Windows Event Log anomaly detection.
This package installs a small, efficient agent on your Windows machine that monitors system logs in real-time and sends them to the LogWatch AI cloud server for ML-powered anomaly detection. The machine learning model (Isolation Forest) runs entirely on the server — your machine only runs the lightweight collector.
Installation
pip install logwatch-ai
Quick Start
1. Get your API key
Log into the LogWatch AI dashboard, go to Projects, create a new project, and copy the generated API key.
2. Run the agent
Option A — Command line:
logwatch-ai --server https://your-server.onrender.com/api/logs/ingest --api-key YOUR_API_KEY
Option B — Config file:
Create a logagent.yaml file:
server_url: "https://your-server.onrender.com/api/logs/ingest"
api_key: "YOUR_API_KEY"
batch_size: 100
poll_interval_seconds: 5
flush_interval_seconds: 60
sqlite_db_path: "local_buffer.db"
Then simply run:
logwatch-ai
Option C — Python API:
from logwatch_ai import LogAgent
agent = LogAgent(
server_url="https://your-server.onrender.com/api/logs/ingest",
api_key="YOUR_API_KEY",
)
agent.run()
How It Works
YOUR WINDOWS MACHINE LOGWATCH AI CLOUD SERVER
┌─────────────────────┐ ┌──────────────────────┐
│ logwatch-ai agent │── HTTPS POST ──▶│ FastAPI + ML Model │
│ (this package) │ X-API-Key │ Isolation Forest │
│ │ │ 25-feature scoring │
│ • Reads Event Logs │ │ Anomaly detection │
│ • Filters noise │ │ Email alerts │
│ • Sends via HTTPS │ │ Dashboard │
│ • ~20KB, no ML │ │ │
└─────────────────────┘ └──────────────────────┘
- The agent reads Windows Application, System, and Security event logs.
- A heuristic pre-filter drops known-benign Windows noise (WidgetService, routine SYSTEM logons, etc.).
- Remaining logs are batched and sent to your cloud server via HTTPS with API key auth.
- The server's ML model (Isolation Forest, 25 features) scores each log for anomalies.
- Detected anomalies trigger email alerts and appear on the dashboard.
Features
| Feature | Description |
|---|---|
| Lightweight | No ML dependencies. Only requests, psutil, pywin32, pyyaml. |
| Offline resilience | If the server is unreachable, logs are buffered in a local SQLite database and replayed automatically when connectivity returns. |
| Heuristic pre-filter | Drops known-benign Windows noise before sending, reducing false positives and network traffic. |
| CPU/RAM metrics | Attaches real-time hardware usage to each log for velocity-based anomaly detection. |
| Auto-restart | Automatically recovers from crashes with a 5-second backoff. |
| CLI + Python API | Use from the command line or import into your own scripts. |
Requirements
- Windows 10/11 (uses Windows Event Log API via pywin32)
- Python 3.10+
- A LogWatch AI cloud server instance with a valid project API key
License
MIT License
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file logwatch_agent-2.0.1.tar.gz.
File metadata
- Download URL: logwatch_agent-2.0.1.tar.gz
- Upload date:
- Size: 20.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c99a37e2fb39f72dd3d30afb94faeae6b3e9208dbee471862357d193cd314ae4
|
|
| MD5 |
0637dccd2bd548c20b627557e0f25246
|
|
| BLAKE2b-256 |
a06ef12c93e8f9883027a777ad323ca4d57f94b6c52c7a63f12de4cf45463eb7
|
File details
Details for the file logwatch_agent-2.0.1-py3-none-any.whl.
File metadata
- Download URL: logwatch_agent-2.0.1-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9138e48bba91893bb3b51b789c4999b5f5512b080cd807bf359f642e2b4659ec
|
|
| MD5 |
8d3d87ee7462072ff070b07f24d33ab9
|
|
| BLAKE2b-256 |
4dd6f9ffaa0a2cc405235febf748e2f5c5855947ec36251c8563fa76466813c9
|