feat(nginx_log): add index_path configuration for custom index storage

This commit is contained in:
0xJacky
2025-10-01 14:13:49 +08:00
parent 641ce53220
commit 6567d929eb
30 changed files with 3115 additions and 3608 deletions

View File

@@ -13,19 +13,34 @@ This section covers configuration options for Nginx log processing and analysis
This option enables advanced indexing for Nginx logs, which provides high-performance log search and analysis capabilities.
### System Requirements
#### Behavior When Disabled (Basic Mode)
#### Minimum Requirements
When `AdvancedIndexingEnabled` is set to `false`, Nginx UI still discovers log entries from your Nginx configuration and shows them in the Logs list. In this basic mode:
- You can view the list of detected log files (grouped by simple rotation patterns), but advanced features like indexing metrics, document counts, and search shards are not available.
- Real-time viewing (tail) continues to work based on resolved access/error log paths.
### IndexPath
- Type: `string`
- Version: `>= v2.2.0`
- By default, Bleve index files are stored in the `log-index` directory located under your Nginx UI config directory (for example, `/usr/local/nginx-ui/log-index`).
- If the config directory cannot be determined, the fallback path is `./log-index` relative to the application.
## System Requirements
### Minimum Requirements
- **CPU**: 1 core minimum
- **Memory**: 2GB RAM minimum
- **Storage**: At least 20GB available disk space
#### Recommended Configuration
### Recommended Configuration
- **CPU**: 2+ cores recommended
- **Memory**: 4GB+ RAM recommended
- **Storage**: SSD storage for better I/O performance
### Performance Metrics
## Performance Metrics
Based on production validation and comprehensive testing (M2 Pro 12 cores, September 2025):
@@ -38,23 +53,23 @@ Based on production validation and comprehensive testing (M2 Pro 12 cores, Septe
| **Adaptive Scaling** | **12→36 workers** | Dynamic resource optimization |
| **Batch Optimization** | **1000→6000** | Real-time throughput tuning |
### Features
## Features
When advanced indexing is enabled, you get access to the following features:
#### Core Capabilities
### Core Capabilities
- **Zero-allocation pipeline** - Optimized memory usage for high-performance processing
- **Dynamic shard management** - Intelligent distribution of log data across shards
- **Incremental index scanning** - Only indexes new log entries for efficiency
- **Automated log rotation detection** - Seamlessly handles rotated log files
#### Search & Analysis
### Search & Analysis
- **Advanced search & filtering** - Complex queries with multiple criteria
- **Full-text search with regex support** - Powerful pattern matching capabilities
- **Cross-file timeline correlation** - Analyze events across multiple log files
- **Error pattern recognition** - Automatic detection of error patterns
#### Data Processing
### Data Processing
- **Compressed log file support** - Works with gzipped and other compressed formats
- **Offline GeoIP analysis** - Location-based analytics without external services
- **Real-time analytics dashboard** - Live monitoring and statistics
@@ -74,4 +89,5 @@ Advanced indexing delivers enterprise-grade performance with **~10,000 records/s
::: warning Initial Indexing
When you enable advanced indexing, the system will immediately start indexing existing log files. This initial indexing process may temporarily impact system performance.
:::
:::

View File

@@ -93,6 +93,7 @@ Applicable for version v2.0.0-beta.37 and above.
| Configuration Setting | Environment Variable |
|------------------------|---------------------------------------|
| AdvancedIndexingEnabled | NGINX_UI_NGINX_LOG_ADVANCED_INDEXING_ENABLED |
| IndexPath | NGINX_UI_NGINX_LOG_INDEX_PATH |
## Node
| Configuration Setting | Environment Variable |

View File

@@ -13,19 +13,34 @@
此选项启用 Nginx 日志的高级索引功能,提供高性能的日志搜索和分析能力。
### 系统要求
#### 关闭时的行为(基础模式)
#### 最低要求
`AdvancedIndexingEnabled``false`Nginx UI 仍会从 Nginx 配置中发现日志入口,并在日志列表中展示。在基础模式下:
- 可以查看已检测到的日志文件列表(基于简单的轮转规则进行分组),但不提供索引指标、文档计数和分片搜索等高级功能。
- 基于解析到的访问/错误日志路径实时查看tail仍可使用。
### IndexPath
- 类型:`string`
- 版本:`>= v2.2.0`
- 默认情况下Bleve 索引文件存放在 Nginx UI 配置目录下的 `log-index` 目录(例如:`/usr/local/nginx-ui/log-index`)。
- 如果无法确定配置目录,回退路径为应用相对路径的 `./log-index`
## 系统要求
### 最低要求
- **CPU**: 最少 1 核心
- **内存**: 最少 2GB RAM
- **存储**: 至少 20GB 可用磁盘空间
#### 推荐配置
### 推荐配置
- **CPU**: 建议 2 核心或以上
- **内存**: 建议 4GB RAM 或以上
- **存储**: 建议使用 SSD 以获得更好的 I/O 性能
### 性能指标
## 性能指标
基于生产环境验证和全面测试M2 Pro 12核心2025年9月
@@ -38,23 +53,23 @@
| **自适应扩展** | **12→36 工作线程** | 动态资源优化 |
| **批处理优化** | **1000→6000** | 实时吞吐量调优 |
### 功能特性
## 功能特性
启用高级索引后,您将获得以下功能:
#### 核心能力
### 核心能力
- **零分配管道** - 优化内存使用以实现高性能处理
- **动态分片管理** - 智能分布日志数据到各个分片
- **增量索引扫描** - 仅索引新的日志条目以提高效率
- **自动日志轮转检测** - 无缝处理轮转的日志文件
#### 搜索与分析
### 搜索与分析
- **高级搜索和过滤** - 支持多条件的复杂查询
- **支持正则表达式的全文搜索** - 强大的模式匹配能力
- **跨文件时间线关联** - 分析多个日志文件中的事件
- **错误模式识别** - 自动检测错误模式
#### 数据处理
### 数据处理
- **压缩日志文件支持** - 支持 gzip 和其他压缩格式
- **离线 GeoIP 分析** - 无需外部服务的位置分析
- **实时分析仪表板** - 实时监控和统计
@@ -74,4 +89,5 @@
::: warning 初始索引
当您启用高级索引时,系统将立即开始索引现有日志文件。此初始索引过程可能会暂时影响系统性能。
:::
:::

View File

@@ -104,6 +104,7 @@
| 配置 | 环境变量 |
|-------------------------|-----------------------------------------------|
| AdvancedIndexingEnabled | NGINX_UI_NGINX_LOG_ADVANCED_INDEXING_ENABLED |
| IndexPath | NGINX_UI_NGINX_LOG_INDEX_PATH |
## Node

View File

@@ -13,19 +13,35 @@
此選項啟用 Nginx 日誌的進階索引功能,提供高效能的日誌搜尋和分析能力。
### 系統需求
#### 關閉時的行為(基礎模式)
#### 最低需求
`AdvancedIndexingEnabled``false`Nginx UI 仍會從 Nginx 設定中發現日誌入口,並在日誌列表中顯示。在基礎模式下:
- 可檢視已偵測到的日誌檔列表(基於簡單的輪轉規則進行分組),但不提供索引指標、文件計數與分片搜尋等進階功能。
- 依據解析出的存取/錯誤日誌路徑即時檢視tail仍可使用。
### IndexPath
- 類型:`string`
- 版本:`>= v2.2.0`
- 預設情況下Bleve 索引檔存放於 Nginx UI 設定目錄下的 `log-index` 目錄(例如:`/usr/local/nginx-ui/log-index`)。
- 若無法判定設定目錄,則回退至應用相對路徑的 `./log-index`
## 系統需求
### 最低需求
- **CPU**: 最少 1 核心
- **記憶體**: 最少 2GB RAM
- **儲存**: 至少 20GB 可用磁碟空間
#### 建議配置
### 建議配置
- **CPU**: 建議 2 核心或以上
- **記憶體**: 建議 4GB RAM 或以上
- **儲存**: 建議使用 SSD 以獲得更好的 I/O 效能
### 效能指標
## 效能指標
基於生產環境驗證和全面測試M2 Pro 12核心2025年9月
@@ -38,23 +54,23 @@
| **自適應擴展** | **12→36 工作執行緒** | 動態資源最佳化 |
| **批次處理最佳化** | **1000→6000** | 即時吞吐量調優 |
### 功能特性
## 功能特性
啟用進階索引後,您將獲得以下功能:
#### 核心能力
### 核心能力
- **零分配管道** - 最佳化記憶體使用以實現高效能處理
- **動態分片管理** - 智慧分布日誌資料到各個分片
- **增量索引掃描** - 僅索引新的日誌條目以提高效率
- **自動日誌輪轉偵測** - 無縫處理輪轉的日誌檔案
#### 搜尋與分析
### 搜尋與分析
- **進階搜尋和過濾** - 支援多條件的複雜查詢
- **支援正規表示式的全文搜尋** - 強大的模式比對能力
- **跨檔案時間線關聯** - 分析多個日誌檔案中的事件
- **錯誤模式識別** - 自動偵測錯誤模式
#### 資料處理
### 資料處理
- **壓縮日誌檔案支援** - 支援 gzip 和其他壓縮格式
- **離線 GeoIP 分析** - 無需外部服務的位置分析
- **即時分析儀表板** - 即時監控和統計
@@ -74,4 +90,4 @@
::: warning 初始索引
當您啟用進階索引時,系統將立即開始索引現有日誌檔案。此初始索引過程可能會暫時影響系統效能。
:::
:::

View File

@@ -104,6 +104,7 @@
| 設定 | 環境變數 |
|-------------------------|-----------------------------------------------|
| AdvancedIndexingEnabled | NGINX_UI_NGINX_LOG_ADVANCED_INDEXING_ENABLED |
| IndexPath | NGINX_UI_NGINX_LOG_INDEX_PATH |
## Node