Installation
Relevant source files
The following files were used as context for generating this wiki page:
LogUtil is a high-performance, real-time Nginx log analyzer built with Rust. The installation process is designed to be flexible, supporting direct binary downloads for major platforms, compilation from source for custom environments, and an interactive setup mode that assists users in configuring analysis parameters upon first launch.
The system relies on the Rust toolchain for building and utilizes the ratatui and crossterm libraries to provide a Terminal User Interface (TUI). Users can deploy the tool by placing the compiled binary into their system path and optionally configuring execution flags for specific modules like security detection or performance monitoring.
Sources: README.md:14-25, Cargo.toml:1-25
Quick Installation
For users on Linux or macOS, LogUtil provides pre-compiled binaries via GitHub Releases. This method bypasses the need for a local Rust development environment.
Linux and macOS Direct Download
Pre-compiled binaries are available for the following architectures:
- Linux (x86_64):
logutil-x86_64-unknown-linux-gnu - Linux (ARM64):
logutil-aarch64-unknown-linux-gnu - macOS (Intel/Universal):
logutil-x86_64-apple-darwin
Typical deployment involves downloading the binary, granting execution permissions, and moving it to a standard binary directory such as /usr/local/bin/.
Sources: README.md:140-161
Building from Source
Building LogUtil from source ensures the binary is optimized for the local CPU architecture. This process requires the Rust toolchain (version supporting the 2021 edition).
Prerequisites
- Rust Toolchain: Installed via
rustupor system package managers. - Cargo: The Rust package manager is used to handle dependencies such as
tokio,regex-lite, andratatui.
Compilation Steps
- Clone the Repository: Obtain the source code from the official GitHub repository.
- Release Build: Execute
cargo build --releaseto generate an optimized binary. The release profile is specifically configured withlto = true,opt-level = "z", andpanic = "abort"to minimize binary size and maximize performance. - Manual Install: Copy the resulting binary from
target/release/logutilto the system's PATH.
Sources: README.md:166-175, Cargo.toml:35-42
System Architecture and Deployment Flow
The following diagram illustrates the workflow from installation/invocation to the operational TUI environment.
The application checks CLI arguments upon execution; if no file is provided, it enters a specialized run_interactive_mode which uses FileSettings to guide the user through directory navigation and parameter adjustment.
Sources: src/main.rs:115-155, src/file_settings.rs:60-100
Configuration Options
During or after installation, LogUtil can be configured using Command Line Interface (CLI) flags. These flags determine which analysis modules (tabs) are loaded into the application state.
Analysis Module Flags
| Flag | Description | Default |
|---|---|---|
--enable-security | Enables the Security tab for threat detection (SQLi, XSS, etc.) | false |
--enable-performance | Enables response time analysis and RPS monitoring | false |
--enable-errors | Enables tracking of 4xx and 5xx HTTP status codes | false |
--enable-bots | Enables detection of crawlers and automated scrapers | false |
--enable-sparkline | Enables real-time request rate visualization | false |
--enable-heatmap | Enables hourly traffic distribution patterns | false |
Sources: src/main.rs:65-95, src/app.rs:44-85
Core Processing Parameters
| Option | Type | Description |
|---|---|---|
count | isize | Lines to read (0=tail, -1=all). |
regex | string | The pattern used to parse log lines into structured data. |
date-format | string | The format string used by the parser (default: %d/%b/%Y:%H:%M:%S %z). |
top | usize | Number of entries to display in top-lists (IPs, URLs). |
Sources: src/main.rs:45-64, src/file_settings.rs:80-130
Internal Initialization Logic
When the binary is launched, the main function initializes the environment and determines the application path.
The App::new implementation uses the AppConfig struct to conditionally push tab implementations (like SecurityTab or PerformanceTab) into the tabs vector, which manages the application's interactive surface.
Sources: src/main.rs:100-110, src/app.rs:44-75
Dependencies and Runtime Requirements
LogUtil is built on a modern async stack. The following key dependencies are required (handled automatically by cargo during source builds):
- Async Runtime:
tokio(full features) for non-blocking file I/O and event polling. - TUI Framework:
ratatuiwithcrosstermbackend for terminal rendering. - Data Structures:
dashmapfor thread-safe in-memory database storage andrayonfor parallel processing. - Parsing:
regex-litefor efficient log pattern matching.
Sources: Cargo.toml:25-34, src/memory_db.rs:1-40
Conclusion
Installation of LogUtil can be achieved instantly via pre-compiled binaries or customized through a source build using the Rust toolchain. Once installed, the tool provides a sophisticated interactive mode for first-time configuration, ensuring that log parsing patterns and active monitoring modules are correctly aligned with the user's specific Nginx environment.