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:
Lucas RayanandClaude Sonnet 5.5 committed 2026-11-16 20:27:18 -03:00
1 parent 19afd221e2
commit 7b90d9e40f
15 files changed
+329 -85

No files matched your search

+17 -1
View File
@@ -867,7 +867,7 @@ func (f *Filter) Match(r *Rec) bool {
if r.T < f.From || (f.To != 0 && r.T > f.To) {
return false
}
if f.Host != "" && r.Host != f.Host {
if f.Host != "" && !hostMatch(f.Host, r.Host) {
return false
}
if len(f.Cats) > 0 && !f.Cats[r.Cat] {
@@ -1164,3 +1164,19 @@ func (l *Log) Counts(from, to int64) map[int64]int64 {
// StartCursor is a cursor that begins an ascending read at time t.
func StartCursor(t int64) string { return encodeCursor(t, 0) }
// hostMatch reports whether host is the filter or one of its comma list.
func hostMatch(filter, host string) bool {
if filter == host {
return true
}
if !strings.Contains(filter, ",") {
return false
}
for _, n := range strings.Split(filter, ",") {
if strings.TrimSpace(n) == host {
return true
}
}
return false
}