feat(nginx-log): 新增 6 张表 phinx migration + Scheme + model

This commit is contained in:
augushong
2026-07-28 00:03:49 +08:00
parent f48e0947cb
commit 0d19881a22
18 changed files with 590 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
<?php
namespace app\admin\model;
use app\common\model\TimeModel;
/**
* @property int $id
* @property string $file_path 来源日志文件路径
* @property string $remote_addr 客户端 IP
* @property string $remote_user HTTP 认证用户名
* @property int $time_local 请求时间戳
* @property string $method HTTP 方法
* @property string $uri 请求 URI
* @property string $query_string 查询字符串
* @property string $http_version HTTP 协议版本
* @property int $status HTTP 状态码
* @property int $body_bytes_sent 响应体字节数
* @property string $http_referer Referer
* @property string $http_user_agent User-Agent
* @property float $request_time 请求总耗时(秒)
* @property float $upstream_response_time upstream 响应时间(秒)
* @property int $bytes_sent 总发送字节数
* @property string $country 国家
* @property string $province 省份
* @property string $city 城市
* @property int $create_time 入库时间戳
*/
class NginxAccessLog extends TimeModel
{
protected $name = 'nginx_access_log';
protected $deleteTime = false;
}

View File

@@ -0,0 +1,24 @@
<?php
namespace app\admin\model;
use app\common\model\TimeModel;
/**
* @property int $id
* @property string $file_path 日志文件绝对路径
* @property int $inode 文件 inode
* @property int $offset 字节偏移
* @property int $last_read_time 上次读取时间戳
* @property string $last_line_hash 上次最后一行 md5
* @property int $parse_fail_count 解析失败累计次数
* @property string $parse_fail_samples 解析失败样本
* @property int $create_time 创建时间戳
* @property int $update_time 更新时间戳
*/
class NginxLogPosition extends TimeModel
{
protected $name = 'nginx_log_position';
protected $deleteTime = false;
}

View File

@@ -0,0 +1,26 @@
<?php
namespace app\admin\model;
use app\common\model\TimeModel;
/**
* @property int $id
* @property int $stat_date 统计日期(YYYYMMDD)
* @property int $stat_hour 小时(0-23)
* @property int $pv 页面浏览量
* @property int $uv 独立访客数
* @property int $total_bytes 总流量(字节)
* @property int $status_2xx 2xx 响应数
* @property int $status_3xx 3xx 响应数
* @property int $status_4xx 4xx 响应数
* @property int $status_5xx 5xx 响应数
* @property int $status_other 其他状态码响应数
* @property float $avg_request_time 平均请求耗时(秒)
*/
class NginxStatHour extends TimeModel
{
protected $name = 'nginx_stat_hour';
protected $deleteTime = false;
}

View File

@@ -0,0 +1,19 @@
<?php
namespace app\admin\model;
use app\common\model\TimeModel;
/**
* @property int $id
* @property int $stat_date 统计日期(YYYYMMDD)
* @property string $referer_domain Referer 来源域名
* @property int $pv 页面浏览量
* @property int $uv 独立访客数
*/
class NginxStatReferer extends TimeModel
{
protected $name = 'nginx_stat_referer';
protected $deleteTime = false;
}

View File

@@ -0,0 +1,20 @@
<?php
namespace app\admin\model;
use app\common\model\TimeModel;
/**
* @property int $id
* @property int $stat_date 统计日期(YYYYMMDD)
* @property string $ua_type UA 类型(browser/spider/unknown)
* @property string $ua_name UA 名称
* @property int $pv 页面浏览量
* @property int $uv 独立访客数
*/
class NginxStatUa extends TimeModel
{
protected $name = 'nginx_stat_ua';
protected $deleteTime = false;
}

View File

@@ -0,0 +1,21 @@
<?php
namespace app\admin\model;
use app\common\model\TimeModel;
/**
* @property int $id
* @property int $stat_date 统计日期(YYYYMMDD)
* @property string $uri 请求 URI
* @property int $pv 页面浏览量
* @property int $uv 独立访客数
* @property int $total_bytes 总流量(字节)
* @property float $avg_request_time 平均请求耗时(秒)
*/
class NginxStatUrl extends TimeModel
{
protected $name = 'nginx_stat_url';
protected $deleteTime = false;
}