LogWatcher is a small real-time remote log viewer.
[Monitored PC (agent)] --WebSocket--> [FastAPI Server] <--WebSocket-- [Browser (frontend)]
agent/— Python agent run on each monitored machineserver/— FastAPI server (central collector and API)frontend/— Browser UI (static frontend)
cd server
pip install -r requirements.txt
python main.pyThe server listens on http://0.0.0.0:8000 by default.
cd agent
pip install -r requirements.txt
python agent.py --server ws://<SERVER_IP>:8000/ws/agentFor reading real Windows Event Logs (optional):
pip install pywin32Without pywin32 the agent runs in demo mode and generates sample log entries.
Open frontend/index.html in your browser.
Set the Server to ws://<SERVER_IP>:8000 (for example ws://192.168.1.100:8000).
Enter the monitored machine IP in Computer IP and click Watch logs.
| Argument | Default | Description |
|---|---|---|
--server |
ws://localhost:8000/ws/agent |
WebSocket URL of the log server |
--interval |
3 |
Log polling interval (seconds) |
| Method | URL | Description |
|---|---|---|
| GET | /api/agents |
List known agents |
| GET | /api/logs/{ip} |
Get buffered logs for an IP |
| GET | /api/logs/{ip}?level=ERROR |
Filter by level |
| GET | /api/logs/{ip}?search=fail |
Search by text |
| DELETE | /api/logs/{ip} |
Clear buffered logs |
| GET | /api/health |
Server health |
| WS | /ws/agent |
WebSocket endpoint for agents |
| WS | /ws/view/{ip} |
WebSocket endpoint for frontend viewers |
FastAPI also exposes interactive API docs at /docs when the server is running.