LoggerAnalyzer is a Go project template designed for backend development homework and log analysis tasks. It demonstrates best practices in structuring Go applications and provides core functionality for processing log files, extracting useful metrics, and generating summary reports in Markdown or AsciiDoc formats.
This repository is intended to help you get familiar with building Go applications using commonly adopted patterns, tools, and libraries. It is suitable for academic and practical backend projects requiring log parsing and analysis.
- Log File Processing: Download and process log files from local paths or URLs.
- Metrics Extraction: Analyze logs to extract key metrics such as request count, average response size, top requested resources, status codes, error codes, and user agents.
- Report Generation: Generate reports with extracted statistics in Markdown or AsciiDoc formats.
- Parallel Processing: Efficiently process large log files in parallel.
- Extensible Structure: Modular design using Go best practices for easy extension and maintenance.
This template follows recommended Go application structuring:
cmd/— Contains application entry points (main files). The default executable isrun, which starts the app.internal/— Application-specific internal packages:application/— Application use cases and business logic.domain/— Core domain models and types.infrastructure/— Infrastructure components for I/O, disk, network, etc.di/— Dependency injection and app startup logic.
pkg/— Reusable packages that may be imported by other Go projects.
- Go 1.20+ installed
Clone the repository:
git clone https://github.com/z0tedd/LoggerAnalyzer.git
cd LoggerAnalyzerRun the application:
go run ./cmd/runYou may need to update the package name in cmd/run/main.go for specific homework tasks.
Test coverage for all packages:
make testThe application generates reports similar to this:
#### Общая информация
| Метрика | Значение |
|---------------------|-------------|
| Количество запросов | 100 |
| Средний размер ответа | 50b |
| 95p размера ответа | 500b |
| Уникальные посетители| 2 |
| Общий объем данных | 5000b |
| Пиковый размер ответа | 0b |
| Ошибки (%) | 0.00% |
| Переадресации (%) | 5.00% |
#### Запрашиваемые ресурсы
| Ресурс | Частота |
|---------------------|-------------|
| /home | 50 |
#### Коды ответа
| Код | Количество |
|---------------------|-------------|
| 200 | 80 |
#### Топ коды ошибок
| Код | Количество |
|---------------------|-------------|
| /home | 50 |
#### Топ User Agents
| User Agent | Количество |
|---------------------|-------------|
| Mozilla/5.0 | 50 |This project is licensed under the GNU License – see the LICENSE file for details.
Feel free to fork, modify, and contribute improvements!
Created for Backend Academy 2024 homework and log analysis projects.