Skip to content

z0tedd/LoggerAnalyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LoggerAnalyzer

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.

Purpose

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.

Features

  • 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.

Project Structure

This template follows recommended Go application structuring:

  • cmd/ — Contains application entry points (main files). The default executable is run, 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.

Usage

Prerequisites

  • Go 1.20+ installed

Running the Application

Clone the repository:

git clone https://github.com/z0tedd/LoggerAnalyzer.git
cd LoggerAnalyzer

Run the application:

go run ./cmd/run

You may need to update the package name in cmd/run/main.go for specific homework tasks.

Testing

Test coverage for all packages:

make test

Example Output

The 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 |

License

This project is licensed under the GNU License – see the LICENSE file for details.

Contributing

Feel free to fork, modify, and contribute improvements!


Created for Backend Academy 2024 homework and log analysis projects.

About

Go log analysis projects: process log files, extract metrics, and generate markdown reports.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •