mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-08-31 05:05:33 +08:00
- 6 张表加 node_id 字段 + position/stat 改复合唯一键(migration) - 6 个 Scheme 同步 node_id 注解 + 唯一键 - Reader 带 node_id 参数 + 懒加载接管(getLastPosition 回退查 node_id='') - Aggregator 全局行(node_id='')+ 按节点循环 insertAggregatesForScope - Stat 所有查询方法加 where node_id 条件 - Dashboard 控制器/视图加节点筛选下拉框 + AJAX 带 node_id - AccessLog 列表加节点列 + 采集进度卡片显示节点信息 - import 定时任务 run_type 改 all(每节点采集自己的日志) - v2.4.0 升级脚本追加 ALTER TABLE(幂等 check-then-alter) - 菜单调整:去掉 Nginx 顶级菜单 + 读取位置管理,改为系统管理下挂两个子菜单 - ulthon-timer 文档补充 run_type=all 多节点部署注意事项
102 lines
4.1 KiB
PHP
102 lines
4.1 KiB
PHP
<?php
|
||
|
||
namespace app\admin\scheme;
|
||
|
||
use app\common\scheme\BaseScheme;
|
||
use app\common\scheme\attribute\Table;
|
||
use app\common\scheme\attribute\Field;
|
||
use app\common\scheme\attribute\Component;
|
||
use app\common\scheme\attribute\Index;
|
||
|
||
#[Table(name: 'ul_nginx_access_log', comment: 'nginx 访问日志明细(解析入库)')]
|
||
#[Index(columns: ['node_id', 'time_local'], name: 'idx_node_time', type: 'NORMAL')]
|
||
#[Index(columns: ['time_local'], name: 'idx_time_local', type: 'NORMAL')]
|
||
#[Index(columns: ['remote_addr'], name: 'idx_remote_addr', type: 'NORMAL')]
|
||
#[Index(columns: ['status'], name: 'idx_status', type: 'NORMAL')]
|
||
#[Index(columns: ['uri'], name: 'idx_uri', type: 'NORMAL')]
|
||
#[Index(columns: ['file_path'], name: 'idx_file_path', type: 'NORMAL')]
|
||
class NginxAccessLog extends BaseScheme
|
||
{
|
||
#[Field(type: 'bigint', nullable: false, unsigned: true, autoIncrement: true, primary: true, comment: '主键ID')]
|
||
public $id;
|
||
|
||
#[Field(type: 'varchar', length: 64, nullable: false, default: '', comment: '节点ID(区分不同采集节点)')]
|
||
public $node_id;
|
||
|
||
#[Field(type: 'varchar', length: 500, nullable: false, comment: '来源日志文件路径')]
|
||
#[Component(type: 'text', options: [])]
|
||
public $file_path;
|
||
|
||
#[Field(type: 'varchar', length: 45, nullable: false, comment: '客户端 IP(含 IPv6)')]
|
||
#[Component(type: 'text', options: [])]
|
||
public $remote_addr;
|
||
|
||
#[Field(type: 'varchar', length: 100, nullable: true, comment: 'HTTP 认证用户名')]
|
||
#[Component(type: 'text', options: [])]
|
||
public $remote_user;
|
||
|
||
#[Field(type: 'int', length: 11, nullable: false, unsigned: true, comment: '请求时间戳(业务时区)')]
|
||
#[Component(type: 'date', options: [])]
|
||
public $time_local;
|
||
|
||
#[Field(type: 'varchar', length: 10, nullable: true, comment: 'HTTP 方法')]
|
||
#[Component(type: 'text', options: [])]
|
||
public $method;
|
||
|
||
#[Field(type: 'varchar', length: 255, nullable: false, comment: '请求 URI(超 255 截断)')]
|
||
#[Component(type: 'text', options: [])]
|
||
public $uri;
|
||
|
||
#[Field(type: 'varchar', length: 500, nullable: false, default: '', comment: '查询字符串')]
|
||
#[Component(type: 'text', options: [])]
|
||
public $query_string;
|
||
|
||
#[Field(type: 'varchar', length: 10, nullable: true, comment: 'HTTP 协议版本')]
|
||
#[Component(type: 'text', options: [])]
|
||
public $http_version;
|
||
|
||
#[Field(type: 'int', length: 11, default: '0', comment: 'HTTP 状态码')]
|
||
#[Component(type: 'text', options: [])]
|
||
public $status;
|
||
|
||
#[Field(type: 'bigint', default: '0', comment: '响应体字节数')]
|
||
#[Component(type: 'text', options: [])]
|
||
public $body_bytes_sent;
|
||
|
||
#[Field(type: 'varchar', length: 500, nullable: false, default: '', comment: 'Referer')]
|
||
#[Component(type: 'text', options: [])]
|
||
public $http_referer;
|
||
|
||
#[Field(type: 'varchar', length: 500, nullable: false, default: '', comment: 'User-Agent(超 500 截断)')]
|
||
#[Component(type: 'textarea', options: [])]
|
||
public $http_user_agent;
|
||
|
||
#[Field(type: 'decimal', precision: 10, scale: 3, default: '0.000', comment: 'nginx 请求总耗时(秒)')]
|
||
#[Component(type: 'text', options: [])]
|
||
public $request_time;
|
||
|
||
#[Field(type: 'decimal', precision: 10, scale: 3, default: '0.000', comment: 'upstream 响应时间(秒)')]
|
||
#[Component(type: 'text', options: [])]
|
||
public $upstream_response_time;
|
||
|
||
#[Field(type: 'bigint', default: '0', comment: '总发送字节数(含 header)')]
|
||
#[Component(type: 'text', options: [])]
|
||
public $bytes_sent;
|
||
|
||
#[Field(type: 'varchar', length: 50, nullable: true, comment: '国家(GeoIP 预留)')]
|
||
#[Component(type: 'text', options: [])]
|
||
public $country;
|
||
|
||
#[Field(type: 'varchar', length: 50, nullable: true, comment: '省份(GeoIP 预留)')]
|
||
#[Component(type: 'text', options: [])]
|
||
public $province;
|
||
|
||
#[Field(type: 'varchar', length: 50, nullable: true, comment: '城市(GeoIP 预留)')]
|
||
#[Component(type: 'text', options: [])]
|
||
public $city;
|
||
|
||
#[Field(type: 'int', length: 11, unsigned: true, comment: '入库时间戳')]
|
||
#[Component(type: 'date', options: [])]
|
||
public $create_time;
|
||
}
|