Skip to main content

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     │                 │                      │
└─────────────────────┘                 └──────────────────────┘
  1. The agent reads Windows Application, System, and Security event logs.
  2. A heuristic pre-filter drops known-benign Windows noise (WidgetService, routine SYSTEM logons, etc.).
  3. Remaining logs are batched and sent to your cloud server via HTTPS with API key auth.
  4. The server's ML model (Isolation Forest, 25 features) scores each log for anomalies.
  5. 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

logwatch_agent-2.0.1.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

logwatch_agent-2.0.1-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

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

Hashes for logwatch_agent-2.0.1.tar.gz
Algorithm Hash digest
SHA256 c99a37e2fb39f72dd3d30afb94faeae6b3e9208dbee471862357d193cd314ae4
MD5 0637dccd2bd548c20b627557e0f25246
BLAKE2b-256 a06ef12c93e8f9883027a777ad323ca4d57f94b6c52c7a63f12de4cf45463eb7

See more details on using hashes here.

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

Hashes for logwatch_agent-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9138e48bba91893bb3b51b789c4999b5f5512b080cd807bf359f642e2b4659ec
MD5 8d3d87ee7462072ff070b07f24d33ab9
BLAKE2b-256 4dd6f9ffaa0a2cc405235febf748e2f5c5855947ec36251c8563fa76466813c9

See more details on using hashes here.

Supported by

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