mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-05 00:31:54 +08:00
限制访问日志中域名能写入的最大长度
This commit is contained in:
@@ -245,7 +245,7 @@ func (this *HTTPAccessLogDAO) CreateHTTPAccessLog(tx *dbs.Tx, dao *HTTPAccessLog
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
fields := map[string]interface{}{}
|
var fields = map[string]any{}
|
||||||
fields["serverId"] = accessLog.ServerId
|
fields["serverId"] = accessLog.ServerId
|
||||||
fields["nodeId"] = accessLog.NodeId
|
fields["nodeId"] = accessLog.NodeId
|
||||||
fields["status"] = accessLog.Status
|
fields["status"] = accessLog.Status
|
||||||
@@ -265,8 +265,12 @@ func (this *HTTPAccessLogDAO) CreateHTTPAccessLog(tx *dbs.Tx, dao *HTTPAccessLog
|
|||||||
fields["remoteAddr"] = accessLog.RemoteAddr
|
fields["remoteAddr"] = accessLog.RemoteAddr
|
||||||
}
|
}
|
||||||
if tableDef.HasDomain {
|
if tableDef.HasDomain {
|
||||||
|
if len(accessLog.Host) > 128 {
|
||||||
|
fields["domain"] = accessLog.Host[:128]
|
||||||
|
} else {
|
||||||
fields["domain"] = accessLog.Host
|
fields["domain"] = accessLog.Host
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
content, err := json.Marshal(accessLog)
|
content, err := json.Marshal(accessLog)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user