mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-03 23:20:25 +08:00
实现实时展示访问日志
This commit is contained in:
@@ -3,10 +3,14 @@ package nodes
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
)
|
||||
|
||||
var requestId int64 = 1_0000_0000_0000_0000
|
||||
|
||||
// 日志
|
||||
func (this *HTTPRequest) log() {
|
||||
// 计算请求时间
|
||||
@@ -73,6 +77,7 @@ func (this *HTTPRequest) log() {
|
||||
}
|
||||
|
||||
accessLog := &pb.HTTPAccessLog{
|
||||
RequestId: strconv.FormatInt(this.requestFromTime.UnixNano(), 10) + strconv.FormatInt(atomic.AddInt64(&requestId, 1), 10) + sharedNodeConfig.PaddedId(),
|
||||
NodeId: sharedNodeConfig.Id,
|
||||
ServerId: this.Server.Id,
|
||||
RemoteAddr: this.requestRemoteAddr(),
|
||||
|
||||
Reference in New Issue
Block a user