MEDIUM: ring: add server statement to forward messages from a ring
This patch adds new statement "server" into ring section, and the
related "timeout connect" and "timeout server".
server <name> <address> [param*]
Used to configure a syslog tcp server to forward messages from ring buffer.
This supports for all "server" parameters found in 5.2 paragraph.
Some of these parameters are irrelevant for "ring" sections.
timeout connect <timeout>
Set the maximum time to wait for a connection attempt to a server to succeed.
Arguments :
<timeout> is the timeout value specified in milliseconds by default, but
can be in any other unit if the number is suffixed by the unit,
as explained at the top of this document.
timeout server <timeout>
Set the maximum time for pending data staying into output buffer.
Arguments :
<timeout> is the timeout value specified in milliseconds by default, but
can be in any other unit if the number is suffixed by the unit,
as explained at the top of this document.
Example:
global
log ring@myring local7
ring myring
description "My local buffer"
format rfc3164
maxlen 1200
size 32764
timeout connect 5s
timeout server 10s
server mysyslogsrv 127.0.0.1:6514
diff --git a/include/types/sink.h b/include/types/sink.h
index ef11096..029c20d 100644
--- a/include/types/sink.h
+++ b/include/types/sink.h
@@ -49,6 +49,14 @@
SINK_FMT_RFC5424, // extended syslog
};
+struct sink_forward_target {
+ struct server *srv; // used server
+ struct appctx *appctx; // appctx of current session
+ size_t ofs; // ring buffer reader offset
+ __decl_hathreads(HA_SPINLOCK_T lock); // lock to protect current struct
+ struct sink_forward_target *next;
+};
+
/* describes the configuration and current state of an event sink */
struct sink {
struct list sink_list; // position in the sink list
@@ -57,6 +65,10 @@
enum sink_fmt fmt; // format expected by the sink
enum sink_type type; // type of storage
uint32_t maxlen; // max message length (truncated above)
+ struct proxy* forward_px; // proxy used to forward
+ struct sink_forward_target *sft; // sink forward targets
+ struct task *forward_task; // task to handle forward targets conns
+ struct sig_handler *forward_sighandler; /* signal handler */
struct {
__decl_hathreads(HA_RWLOCK_T lock); // shared/excl for dropped
struct ring *ring; // used by ring buffer and STRM sender