mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-09 03:50:26 +08:00
NS日志增加remoteAddr字段
This commit is contained in:
@@ -241,7 +241,7 @@ func findNSAccessLogTable(db *dbs.DB, day string, force bool) (string, error) {
|
||||
}
|
||||
|
||||
// 创建表格
|
||||
_, err = db.Exec("CREATE TABLE `" + tableName + "` (\n `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',\n `nodeId` int(11) unsigned DEFAULT '0' COMMENT '节点ID',\n `domainId` int(11) unsigned DEFAULT '0' COMMENT '域名ID',\n `recordId` int(11) unsigned DEFAULT '0' COMMENT '记录ID',\n `content` json DEFAULT NULL COMMENT '访问数据',\n `requestId` varchar(128) DEFAULT NULL COMMENT '请求ID',\n `createdAt` bigint(11) unsigned DEFAULT '0' COMMENT '创建时间',\n PRIMARY KEY (`id`),\n KEY `nodeId` (`nodeId`),\n KEY `domainId` (`domainId`),\n KEY `recordId` (`recordId`),\n KEY `requestId` (`requestId`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='域名服务访问日志';")
|
||||
_, err = db.Exec("CREATE TABLE `" + tableName + "` (\n `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',\n `nodeId` int(11) unsigned DEFAULT '0' COMMENT '节点ID',\n `domainId` int(11) unsigned DEFAULT '0' COMMENT '域名ID',\n `recordId` int(11) unsigned DEFAULT '0' COMMENT '记录ID',\n `content` json DEFAULT NULL COMMENT '访问数据',\n `requestId` varchar(128) DEFAULT NULL COMMENT '请求ID',\n `createdAt` bigint(11) unsigned DEFAULT '0' COMMENT '创建时间',\n `remoteAddr` varchar(128) DEFAULT NULL COMMENT 'IP',\n PRIMARY KEY (`id`),\n KEY `nodeId` (`nodeId`),\n KEY `domainId` (`domainId`),\n KEY `recordId` (`recordId`),\n KEY `requestId` (`requestId`),\n KEY `remoteAddr` (`remoteAddr`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='域名服务访问日志';")
|
||||
if err != nil {
|
||||
return tableName, err
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ type NSAccessLog struct {
|
||||
Content string `field:"content"` // 访问数据
|
||||
RequestId string `field:"requestId"` // 请求ID
|
||||
CreatedAt uint64 `field:"createdAt"` // 创建时间
|
||||
RemoteAddr string `field:"remoteAddr"` // IP
|
||||
}
|
||||
|
||||
type NSAccessLogOperator struct {
|
||||
@@ -19,6 +20,7 @@ type NSAccessLogOperator struct {
|
||||
Content interface{} // 访问数据
|
||||
RequestId interface{} // 请求ID
|
||||
CreatedAt interface{} // 创建时间
|
||||
RemoteAddr interface{} // IP
|
||||
}
|
||||
|
||||
func NewNSAccessLogOperator() *NSAccessLogOperator {
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user