[功能] 实现节点访问日志的分片支持,优化日志查询和管理逻辑

This commit is contained in:
ryan
2026-03-19 16:19:46 +08:00
parent 891cb7b9c1
commit dd49b2777d
13 changed files with 709 additions and 152 deletions
@@ -327,18 +327,28 @@ type trafficCountItem struct {
value int64
}
const accessLogPathMaxRunes = 100
func normalizeAccessLogPath(value string) string {
trimmed := strings.TrimSpace(value)
if trimmed == "" {
return ""
}
if strings.HasPrefix(trimmed, "http://") || strings.HasPrefix(trimmed, "https://") {
return trimmed
return truncateAccessLogPath(trimmed)
}
if strings.HasPrefix(trimmed, "/") {
return trimmed
return truncateAccessLogPath(trimmed)
}
return "/" + trimmed
return truncateAccessLogPath("/" + trimmed)
}
func truncateAccessLogPath(value string) string {
runes := []rune(value)
if len(runes) <= accessLogPathMaxRunes {
return value
}
return string(runes[:accessLogPathMaxRunes])
}
func topCounts(values map[string]int64, limit int) map[string]int64 {