Settings > Sources: turn syslog reception on/off, choose UDP/TCP

- SyslogServer opens and closes the UDP/TCP listeners at runtime from the
  configuration saved in /data/syslog.json; a busy port no longer stops
  Logstream, the error is shown in Settings instead.
- Sources tab: syslog section with an on/off switch, UDP and TCP labels,
  the live listening state and the published port (SYSLOG_PORT, passed as
  SYSLOG_PUBLIC_PORT for display; the mapping stays in docker-compose).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
cedricandClaude Opus 5.5 committed 2026-09-28 17:37:08 +02:00
1 parent 7beb791e44
commit 32593b9515
9 files changed
+278 -28

No files matched your search

-24
View File
@@ -225,30 +225,6 @@ func parseHostTag(e *Entry, s string, withHost bool) {
e.Message = s
}
// StartSyslog starts the UDP and TCP listeners on the same address.
func StartSyslog(ctx context.Context, addr string, sink func(*Entry)) error {
pc, err := net.ListenPacket("udp", addr)
if err != nil {
return err
}
ln, err := net.Listen("tcp", addr)
if err != nil {
pc.Close()
return err
}
if uc, ok := pc.(*net.UDPConn); ok {
_ = uc.SetReadBuffer(8 << 20)
}
go func() {
<-ctx.Done()
pc.Close()
ln.Close()
}()
go serveUDP(ctx, pc, sink)
go serveTCP(ctx, ln, sink)
return nil
}
func serveUDP(ctx context.Context, pc net.PacketConn, sink func(*Entry)) {
buf := make([]byte, 65536)
for {