edge-node accesslog命令输出增加发送内容字节数、请求来源、请求UserAgent

This commit is contained in:
GoEdgeLab
2024-05-01 19:29:07 +08:00
parent ea39310b7e
commit cb455b8a84

View File

@@ -10,6 +10,7 @@ import (
"github.com/iwind/TeaGo/types"
"net"
"os"
"strconv"
"sync"
"sync/atomic"
)
@@ -94,7 +95,7 @@ func (this *HTTPAccessLogViewer) Send(accessLog *pb.HTTPAccessLog) {
for _, conn := range conns {
// ignore error
_, _ = conn.Write([]byte(accessLog.RemoteAddr + " [" + accessLog.TimeLocal + "] \"" + accessLog.RequestMethod + " " + accessLog.Scheme + "://" + accessLog.Host + accessLog.RequestURI + " " + accessLog.Proto + "\" " + types.String(accessLog.Status) + " - " + fmt.Sprintf("%.2fms", accessLog.RequestTime*1000) + "\n"))
_, _ = conn.Write([]byte(accessLog.RemoteAddr + " [" + accessLog.TimeLocal + "] \"" + accessLog.RequestMethod + " " + accessLog.Scheme + "://" + accessLog.Host + accessLog.RequestURI + " " + accessLog.Proto + "\" " + types.String(accessLog.Status) + " " + types.String(accessLog.BytesSent) + " " + strconv.Quote(accessLog.Referer) + " " + strconv.Quote(accessLog.UserAgent) + " - " + fmt.Sprintf("%.2fms", accessLog.RequestTime*1000) + "\n"))
}
}