Centralized Log Collection & Monitoring Platform
A modern, self-hosted alternative for aggregating logs from distributed services with real-time analytics and visualization.
- Auto-provisioning Projects: Send logs with a project name and Lighthouse automatically creates the project
- RESTful API: Simple HTTP API for log ingestion from any service or language
- Real-time Monitoring: Live log streaming with filtering by level, service, and time range
- Visual Analytics: Charts for log distribution, frequency trends, and service health
- Structured Metadata: Store and query rich contextual data with each log entry
- Multi-level Logging: Support for DEBUG, INFO, WARN, and ERROR levels
- Expandable Log View: Click to expand logs and view full messages and metadata
- Project Isolation: Organize logs by projects with individual API keys
- Self-hosted: Full control over your data with SQLite storage
Real-time overview with log frequency chart, project stats and key metrics
Filter and search through all log entries across projects and services
Expand individual entries to inspect full messages and structured metadata
Get started in seconds with Docker:
docker pull ghcr.io/codemaster4711/lighthouse/lighthouse:latest
docker run -d \
-p 3000:3000 \
-v lighthouse-data:/app/data \
-e SESSION_SECRET=your-secret-key \
--name lighthouse \
ghcr.io/codemaster4711/lighthouse/lighthouse:latestOr use Docker Compose:
git clone https://github.com/yourusername/lighthouse.git
cd lighthouse
docker-compose up -dAccess the application at http://localhost:3000
- Node.js 18+
- npm or pnpm
git clone https://github.com/yourusername/lighthouse.git
cd lighthouse
npm install- Copy the example environment file:
cp .env.example .env- Configure your environment variables in
.env
npm run devThe application will be available at http://localhost:5173
Send logs to Lighthouse using a simple HTTP POST request:
curl -X POST http://your-lighthouse-instance/api/logs \
-H "Content-Type: application/json" \
-d '{
"project_name": "my-api",
"level": "INFO",
"source": "auth-service",
"message": "User login successful",
"metadata": {
"user_id": "12345",
"ip": "192.168.1.100"
}
}'async function sendLog(level, source, message, metadata = {}) {
await fetch("http://your-lighthouse-instance/api/logs", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
project_name: "my-service",
level,
source,
message,
metadata,
}),
});
}
await sendLog("ERROR", "payment-service", "Payment failed", {
order_id: "456",
});import requests
def send_log(level, source, message, metadata=None):
requests.post(
'http://your-lighthouse-instance/api/logs',
json={
'project_name': 'my-service',
'level': level,
'source': source,
'message': message,
'metadata': metadata or {}
}
)
send_log('WARN', 'database-service', 'Connection slow', {'latency_ms': 2500})package main
import (
"bytes"
"encoding/json"
"net/http"
)
type LogEntry struct {
ProjectName string `json:"project_name"`
Level string `json:"level"`
Source string `json:"source"`
Message string `json:"message"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
func SendLog(entry LogEntry) error {
body, _ := json.Marshal(entry)
_, err := http.Post(
"http://your-lighthouse-instance/api/logs",
"application/json",
bytes.NewBuffer(body),
)
return err
}Full API documentation is available at /api/docs when running the application, or check out the API Guide.
POST /api/logs- Create a log entryGET /api/logs- Retrieve logs with filteringGET /api/logs/stats- Get log statistics and analyticsGET /api/projects- List all projectsPOST /api/projects- Create a new project
- Frontend: SvelteKit 5, TypeScript, TailwindCSS, Shadcn-Svelte
- Backend: SvelteKit API Routes
- Database: SQLite with better-sqlite3
- Validation: Zod
- Charts: Recharts
- Icons: Lucide Icons
lighthouse/
├── src/
│ ├── lib/
│ │ ├── components/ # UI components
│ │ ├── server/ # Server-side logic
│ │ │ ├── repositories/ # Data access layer
│ │ │ └── db.ts # Database connection
│ │ └── shared/ # Shared types and schemas
│ └── routes/
│ ├── api/ # API endpoints
│ ├── logs/ # Logs UI
│ └── api/docs/ # API documentation
├── static/ # Static assets
└── database/ # SQLite database
npm run testnpm run buildDatabase schema is automatically initialized on first run. Check src/lib/server/db.ts for schema definitions.
- Use consistent
sourcenames across your services for better filtering - Include relevant metadata (user IDs, request IDs, trace IDs) for debugging
- Use appropriate log levels:
- DEBUG: Development and debugging information
- INFO: General informational events
- WARN: Warning messages for potentially harmful situations
- ERROR: Error events that might still allow the application to continue
- Send logs asynchronously to avoid blocking your application
- Cache
project_idafter first creation instead of usingproject_namerepeatedly
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Documentation: Check
/api/docsin your running instance - Issues: GitHub Issues
- Discussions: GitHub Discussions