How igreat/log-viewer works
Project type and purpose
• This is a full‑stack prototype “Log Viewer Tool” with a modern, responsive single‑page client and a Python/FastAPI backend. Its purpose is to let engineers upload, view, filter, and analyze log files, including AI‑driven summarization and issue detection.
File structure
• Top‑level directories:
• client/: the front‑end application (HTML, JS modules, SCSS, test suites, build configs)
• server/: the backend (FastAPI app, AI model clients, utilities, tests)
• test‑logs/: sample JSON logs
• Key patterns:
• Client is modular JS (agent.js, filterGroup.js, search.js, etc.) packaged with Vite.
• Server is a monolithic FastAPI service that imports model_client modules for online (OpenAI) or optional offline inference (llama.cpp).
• Elasticsearch is used as the log database/search engine.
README insights
• Frontend: built with Vite, jQuery, Bootstrap, Split.js, Marked.js; tested with Jest.
• Backend: Python 3.12+, FastAPI + Uvicorn, elasticsearch-py, OpenAI SDK, sentence-transformers; optional llama-cpp-python.
• Features: upload/view logs, client‑side filtering, server‑side AI analysis (summaries, known issue detection, filter suggestions), workspaces & categories.
Main components
a. Frontend (Browser Single‑Page App)
– UI modules (upload, table view, filters, AI chat panel)
– JS services (agent.js for chat, search.js, priorityQueue.js, trie.js for efficient filtering)
b. API Server (FastAPI Application)
– HTTP endpoints for log upload, retrieval, filtering, AI agent interactions
– model_client layer: OpenAIModelClient and OfflineModelClient
– utils (shared helpers)
c. Log Storage/Search (Elasticsearch Cluster)
d. AI Services
– External OpenAI API (gpt‑4o or other models)
– Optional offline inference via llama.cpp models
e. Test Artifacts
– sample logs (test‑logs), client Jest tests, server pytest
Relationships and interactions
• User interacts with frontend in browser → triggers HTTP calls to FastAPI (upload, fetch, filter, AI analyze)
• FastAPI endpoints receive requests → read/write logs in Elasticsearch → call model_client to analyze logs → return JSON responses
• Frontend receives responses → updates UI tables, filter groups, AI chat interface
Architectural patterns and principles
• Client‑Server separation (clear API boundary)
• Modular JS components on frontend for separation of concerns (search algorithms, UI controls, styling)
• Backend layering: routing (FastAPI), service layer (model_client), data layer (Elasticsearch)
• Pluggable AI clients enabling both online and offline inference
Relevant technologies/frameworks
• Frontend: Vite, vanilla JS modules, SCSS, jQuery, Bootstrap, Split.js, Jest
• Backend: Python 3.12+, FastAPI, Uvicorn, elasticsearch-py, openai SDK, sentence-transformers, llama-cpp-python
• Database: Elasticsearch (self‑hosted cluster)
• External services: OpenAI API, optional local gguf model with llama.cpp