fix: host filter accepts all and comma lists; hub no longer drops traefik lines after a copytruncate rotation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
19afd221e2
commit
7b90d9e40f
15 files changed
+329
-85
No files matched your search
@@ -37,13 +37,13 @@ func (s *Server) eventFilter(w http.ResponseWriter, r *http.Request, defaultSpan
|
||||
}
|
||||
eq.From, eq.To = rg.Bounds(s.opt.Now().Unix())
|
||||
eq.Host = q.Get("host")
|
||||
if eq.Host == "all" {
|
||||
eq.Host = ""
|
||||
}
|
||||
if len(eq.Host) > 64 {
|
||||
if !hostListOK(eq.Host) {
|
||||
badRequest(w, "invalid host")
|
||||
return eq, false
|
||||
}
|
||||
if sel, ok := s.parseHosts(eq.Host); ok { // "all" and a list naming every node become ""
|
||||
eq.Host = sel.csv(s.opt.Store.Name())
|
||||
}
|
||||
if ip := q.Get("ip"); ip != "" {
|
||||
_, err1 := netip.ParseAddr(ip)
|
||||
_, err2 := netip.ParsePrefix(ip)
|
||||
@@ -217,21 +217,19 @@ func (s *Server) sessionsAPI(w http.ResponseWriter, r *http.Request) {
|
||||
}{list[from:to], gap, trunc, s.opt.Store.EventLog() != nil, pageTotal{metaOf(len(list), page, per), len(list)}})
|
||||
}
|
||||
|
||||
// studyHosts resolves the host selection of period and metrics: whether the
|
||||
// local study is wanted and which peers to ask. It answers 404 itself.
|
||||
// studyHosts resolves the host selection of period and metrics (one name, "all"
|
||||
// or a comma list): whether the local study is wanted and which peers to ask
|
||||
// (only: their names, comma separated). It answers 404 itself.
|
||||
func (s *Server) studyHosts(w http.ResponseWriter, host string) (local bool, peers bool, only string, ok bool) {
|
||||
self := s.opt.Store.Name()
|
||||
if host == "" || host == "all" {
|
||||
return true, s.opt.Hub != nil, "", true
|
||||
}
|
||||
if host == self {
|
||||
return true, false, "", true
|
||||
}
|
||||
if s.opt.Hub == nil || !s.opt.Hub.Has(host) {
|
||||
sel, ok := s.parseHosts(host)
|
||||
if !ok {
|
||||
writeJSON(w, http.StatusNotFound, map[string]string{"error": "unknown host"})
|
||||
return false, false, "", false
|
||||
}
|
||||
return false, true, host, true
|
||||
if sel.all {
|
||||
return true, s.opt.Hub != nil, "", true
|
||||
}
|
||||
return sel.local, len(sel.peers) > 0, sel.only(), true
|
||||
}
|
||||
|
||||
// userSlot admits one more user-side study (503 with Retry-After when four run).
|
||||
|
||||
Reference in new issue
Block a user