From f8340e38bf1830a37b6b934d77210246b93d7cbf Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 26 Sep 2019 08:05:15 +0200 Subject: [PATCH] MINOR: sink: change ring buffer "buf0"'s format to "timed" This way we now always have the events date which were really missing, especially when used with traces : <0>2019-09-26T07:57:25.183845 [00|h2|1|mux_h2.c:3024] receiving H2 HEADERS frame : h2c=0x1ddcad0(B,FRP) h2s=0x1dde9e0(3,HCL) <0>2019-09-26T07:57:25.183845 [00|h2|4|mux_h2.c:2505] h2c_bck_handle_headers(): entering : h2c=0x1ddcad0(B,FRP) h2s=0x1dde9> <0>2019-09-26T07:57:25.183846 [00|h2|4|mux_h2.c:4096] h2c_decode_headers(): entering : h2c=0x1ddcad0(B,FRP) <0>2019-09-26T07:57:25.183847 [00|h2|4|mux_h2.c:4298] h2c_decode_headers(): leaving : h2c=0x1ddcad0(B,FRH) <0>2019-09-26T07:57:25.183848 [00|h2|0|mux_h2.c:2559] rcvd H2 response : h2c=0x1ddcad0(B,FRH) : [3] H2 RES: HTTP/2.0 200 <0>2019-09-26T07:57:25.183849 [00|h2|4|mux_h2.c:2560] h2c_bck_handle_headers(): leaving : h2c=0x1ddcad0(B,FRH) h2s=0x1dde9e> <0>2019-09-26T07:57:25.183849 [00|h2|4|mux_h2.c:2866] h2_process_demux(): no more Rx data : h2c=0x1ddcad0(B,FRH) <0>2019-09-26T07:57:25.183849 [00|h2|4|mux_h2.c:3123] h2_process_demux(): notifying stream before switching SID : h2c=0x1dd> <0>2019-09-26T07:57:25.183850 [00|h2|4|mux_h2.c:1014] h2s_notify_recv(): in : h2c=0x1ddcad0(B,FRH) h2s=0x1dde9e0(3,HCL) <0>2019-09-26T07:57:25.183850 [00|h2|4|mux_h2.c:3135] h2_process_demux(): leaving : h2c=0x1ddcad0(B,FRH) <0>2019-09-26T07:57:25.183851 [00|h2|4|mux_h2.c:3319] h2_send(): entering : h2c=0x1ddcad0(B,FRH) <0>2019-09-26T07:57:25.183851 [00|h2|4|mux_h2.c:3145] h2_process_mux(): entering : h2c=0x1ddcad0(B,FRH) <0>2019-09-26T07:57:25.183851 [00|h2|4|mux_h2.c:3234] h2_process_mux(): leaving : h2c=0x1ddcad0(B,FRH) <0>2019-09-26T07:57:25.183852 [00|h2|4|mux_h2.c:3428] h2_send(): leaving with everything sent : h2c=0x1ddcad0(B,FRH) <0>2019-09-26T07:57:25.183852 [00|h2|4|mux_h2.c:3319] h2_send(): entering : h2c=0x1ddcad0(B,FRH) It looks like some format options could finally be separate from the sink, or maybe enforced. For example we could imagine making the date optional or its resolution configurable within a same buffer. Similarly, maybe trace events would like to always emit the date even on stdout, while traffic logs would prefer not to emit the date in the ring buffer given that there's already one in the message. --- src/sink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sink.c b/src/sink.c index e2270b156..1d30f632d 100644 --- a/src/sink.c +++ b/src/sink.c @@ -250,7 +250,7 @@ static void sink_init() { sink_new_fd("stdout", "standard output (fd#1)", SINK_FMT_RAW, 1); sink_new_fd("stderr", "standard output (fd#2)", SINK_FMT_RAW, 2); - sink_new_buf("buf0", "in-memory ring buffer", SINK_FMT_RAW, 1048576); + sink_new_buf("buf0", "in-memory ring buffer", SINK_FMT_TIMED, 1048576); } static void sink_deinit()