
LogSpot
A lightweight Flask/Fast API extension that provides a built-in log viewer with filtering, search, download, and alerting capabilities directly from the browser.
Timeline
1-2 Weeks
Role
Backend Developer
Team
Solo
Status
Published (PyPI Package)Technology Stack
Key Challenges
- Reusable Flask Extension Design
- Efficient Log Storage & Retrieval
- Search & Filtering Optimization
- Secure Log Access
- Real-time Alerting
Key Learnings
- Python Package Publishing
- Flask Extension Architecture
- Logging Systems Design
- API Design for Utilities
- Open-source Maintenance
Overview
LogSpot is a reusable Flask extension that simplifies log monitoring by exposing a built-in /logs route in any Flask application. It enables developers to view, filter, search, and download logs directly from the browser without setting up external logging dashboards.
Since logs may contain sensitive system data, I implemented authentication to restrict access and ensure secure observability.
The extension also provides a clean logging interface attached to the Flask app instance and supports real-time alerts via Telegram for critical errors.
Key Features
Core Functionalities
- Instant Log Viewer: Access logs via
/logsroute - Filtering: Filter logs by severity (INFO, DEBUG, ERROR, etc.)
- Search: Keyword-based log search
- Pagination/Limit: Control number of log entries
- Download Logs: Export logs as
.logfile - Simple Logging API: Direct methods like
logger.info() - Telegram Alerts: Notify on critical errors
How It Works
- Setup → Initialize using
setup_logs(app) - Route Injection →
/logsendpoint automatically registered - Logging Interface → Methods attached to app instance
- Log Processing → Store and filter logs dynamically
- Alert System → Trigger Telegram notifications for critical logs
Example Usage
from flask import Flask
from logspot import setup_logs
app = Flask(__name__)
logger = setup_logs(app, service="resbot",telegram_chat_id=OWNER_CHAT_ID, telegram_bot_token=BOT_ID, logs_user="admin", logs_pass="1234")
@app.route("/")
def index():
logger.info("Index page accessed")
return "Hello, World!"