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