How bagpotato/loglens works
LogLens collects server logs, ranks events by deterministic severity, and provides searchable history, live tailing, AI explanations/chat, and critical-event phone alerts. The principal path is monitored host → Loki ingestion → API query and classification → web/mobile UI; AI and alerts are additional branches. Edges are limited to README-documented relationships and sampled source calls; unsampled wiring is omitted or shown only where explicitly documented.
Main entry points: main.rs API server · main.tsx LogLens web app · routes HTTP routes · query.rs Loki adapter
Components 23
Log ingestion
- Vector agent
Backend services
- API server
backend/crates/api/src/main.rs - HTTP routes
backend/crates/api/src/routes - Log query service
backend/crates/api/src/query.rs - Loki adapter
backend/crates/loki/src/query.rs - Loki HTTP client
backend/crates/loki/src/client.rs - Severity ranking
backend/crates/severity/src/classifier.rs - Authentication
backend/crates/auth/src/login.rs - AI workflows
backend/crates/ai/src/query_planner.rs - AI providers
backend/crates/ai/src/providers/mod.rs - Critical alerts
backend/crates/alerts/src/poller.rs - State storage
backend/crates/storage/src
Web and mobile UI
- LogLens web app
frontend/src/main.tsx - Search and live logs
frontend/src/features/logs - Severity overview
frontend/src/features/overview - AI chat and explain
frontend/src/features/ai - Sign-in UI
frontend/src/features/auth - Android app shell
mobile/src-tauri/src/app.rs
External services
- Loki log store
- AI provider service
- ntfy notifications
Other components
- Monitored servers
- Phone user
Connections 26
- Monitored servers → Vector agent: emits logs
- Vector agent → Loki log store: pushes logs
- Loki log store → Loki adapter: serves queries
- API server → HTTP routes: registers routes
- HTTP routes → Log query service: queries logs
backend/crates/api/src/query.rs - Log query service → Loki adapter: loads entries
backend/crates/api/src/query.rs - Loki adapter → Loki HTTP client: requests data
backend/crates/loki/src/query.rs - Loki adapter → Loki log store: queries and tails
- API server → Severity ranking: ranks events
- HTTP routes → Authentication: authenticates requests
- HTTP routes → AI workflows: handles AI requests
- AI workflows → AI providers: completes prompts
- AI providers → AI provider service: sends requests
- API server → Critical alerts: polls critical events
- Critical alerts → ntfy notifications: sends notifications
- ntfy notifications → Phone user: notifies user
- Authentication → State storage: persists account state
- LogLens web app → Search and live logs: routes to logs
- LogLens web app → Severity overview: routes to overview
- LogLens web app → AI chat and explain: routes to chat
- LogLens web app → Sign-in UI: routes to sign-in
- Search and live logs → API server: requests logs
- Severity overview → API server: requests summaries
- AI chat and explain → API server: streams AI answers
- Sign-in UI → API server: signs in
- Android app shell → LogLens web app: packages same frontend