feat: add RELP handler for reliable log delivery to rsyslog (closes #5) #6

zavřený
clawbot chce sloučit 3 commity z větve (odstraněno):feat/relp-handler do main
Spolupracovník

Implements the planned RELP feature from the README.

What

  • New RELPHandler that delivers log messages to a remote rsyslog server via RELP (TCP)
  • Configured via LOGGER_RELP_URL env var (e.g. tcp://rsyslog.example.com:2514)
  • Pure Go implementation — no CGO, no librelp dependency

How it works

  • Lazy connection on first log message
  • RELP session: open handshake → syslog commands → graceful close
  • Per-message acknowledgement (waits for rsp 200 from server)
  • Auto-reconnect on connection failure
  • Messages formatted as RFC 5424 syslog with structured data from slog attributes
  • Transaction number tracking with proper wraparound at 999,999,999

Notes

  • Also includes the deadlock fix from #3 (cherry-picked) since it was needed as a clean base
  • No TLS support yet (could be added later via tls:// scheme)
  • Default port 2514 (standard RELP/imrelp port)

Closes #5

Implements the planned RELP feature from the README. ## What - New `RELPHandler` that delivers log messages to a remote rsyslog server via RELP (TCP) - Configured via `LOGGER_RELP_URL` env var (e.g. `tcp://rsyslog.example.com:2514`) - Pure Go implementation — no CGO, no librelp dependency ## How it works - Lazy connection on first log message - RELP session: `open` handshake → `syslog` commands → graceful `close` - Per-message acknowledgement (waits for `rsp 200` from server) - Auto-reconnect on connection failure - Messages formatted as RFC 5424 syslog with structured data from slog attributes - Transaction number tracking with proper wraparound at 999,999,999 ## Notes - Also includes the deadlock fix from #3 (cherry-picked) since it was needed as a clean base - No TLS support yet (could be added later via `tls://` scheme) - Default port 2514 (standard RELP/imrelp port) Closes #5
clawbot přidal/a 2 commity 2026-02-08 18:17:52 +01:00
Vlastník

isn't there a relp library we can use?

isn't there a relp library we can use?
clawbot byl přiřazen sneak 2026-02-08 18:39:28 +01:00
Vlastník

@clawbot ping

@clawbot ping
sneak přidal/a 1 commit 2026-02-23 20:59:30 +01:00
Autor
Spolupracovník

There are two Go RELP libraries:

  1. stith/gorelp — simple client+server, but server-only focus (no client Send method). Last commit ~10 years ago.
  2. thierry-f-78/go-relp — server-side only (designed for receiving RELP). No client implementation.

Neither provides a usable RELP client — they're both server/receiver libraries. For sending logs via RELP we'd need a client implementation, which is what this PR does.

That said, the protocol is simple enough (framed TCP with txn ack) that a clean ~200 line implementation is reasonable. Want me to slim down the current implementation, or would you prefer a different approach (e.g. plain syslog over TCP instead of RELP)?

There are two Go RELP libraries: 1. **[stith/gorelp](https://github.com/stith/gorelp)** — simple client+server, but server-only focus (no client Send method). Last commit ~10 years ago. 2. **[thierry-f-78/go-relp](https://github.com/thierry-f-78/go-relp)** — server-side only (designed for receiving RELP). No client implementation. Neither provides a usable RELP *client* — they're both server/receiver libraries. For sending logs via RELP we'd need a client implementation, which is what this PR does. That said, the protocol is simple enough (framed TCP with txn ack) that a clean ~200 line implementation is reasonable. Want me to slim down the current implementation, or would you prefer a different approach (e.g. plain syslog over TCP instead of RELP)?
clawbot uzavřel/a tento pull request 2026-03-01 15:00:08 +01:00

Pull request uzavřen

Přihlaste se pro zapojení do konverzace.
Žádní posuzovatelé
2 účastníků
Oznámení
Termín dokončení
Žádný termín dokončení.
Závislosti

Nejsou nastaveny žádné závislosti.

Reference: sneak/simplelog#6