deny - - - - - X X -
dgram-drop X - - - - - - -
disable-l7-retry - - - - - X - -
+do-log X X X X X X X X
do-resolve - - - X - X - -
early-hint - - - - - X - -
expect-netscaler-cip - X - - - - - -
reason than a connection failure. This can be useful for example to make
sure POST requests aren't retried on failure.
+do-log
+ Usable in: QUIC Ini| TCP RqCon| RqSes| RqCnt| RsCnt| HTTP Req| Res| Aft
+ X | X | X | X | X | X | X | X
+
+ This action manually triggers a log emission on the proxy. This means
+ log options on the proxy will be considered (including formatting options
+ such as "log-format"), but it will not interfere with the logs automatically
+ generated by the proxy during transaction handling. It currently doesn't
+ support any argument, though extensions may appear in future versions.
+
+ Using "log-profile", it is possible to precisely describe how the log should
+ be emitted for each of the available contexts where the action may be used.
+ That is, 'on' keyword followed by of the following values: 'quic-init',
+ 'tcp-req-conn', 'tcp-req-sess', 'tcp-req-cont', 'tcp-res-cont', 'http-req',
+ 'http-res', 'http-after-res'.
+
+ Also, they will be properly reported when using "%OG" logformat alias.
+
+ Example:
+ log-profile myprof
+ on tcp-req-conn format "Connect: %ci"
+
+ frontend myfront
+ log stdout format rfc5424 profile myprof local0
+ log-format "log generated using proxy logformat, from '%OG'"
+ tcp-request connection do-log #uses special log-profile format
+ tcp-request content do-log #uses proxy logformat
do-resolve(<var>,<resolvers>,[ipv4,ipv6]) <expr>
Usable in: QUIC Ini| TCP RqCon| RqSes| RqCnt| RsCnt| HTTP Req| Res| Aft
- "any" : override both log-format and error-log-format for all logging
steps, unless a more precise step override is declared.
+ See "do-log" action for relevant additional <step> values.
+
This setting is only relevant for "log" directives used from contexts where
using "log-format" directive makes sense (e.g.: http and tcp proxies).
Else it will simply be ignored.
return ACT_RET_PRS_OK;
}
+static enum log_orig_id do_log_http_req;
+static enum log_orig_id do_log_http_res;
+static enum log_orig_id do_log_http_after_res;
+
+static void init_do_log(void)
+{
+ do_log_http_req = log_orig_register("http-req");
+ BUG_ON(do_log_http_req == LOG_ORIG_UNSPEC);
+ do_log_http_res = log_orig_register("http-res");
+ BUG_ON(do_log_http_res == LOG_ORIG_UNSPEC);
+ do_log_http_after_res = log_orig_register("http-after-res");
+ BUG_ON(do_log_http_after_res == LOG_ORIG_UNSPEC);
+}
+
+INITCALL0(STG_PREPARE, init_do_log);
+
+static enum act_parse_ret parse_http_req_do_log(const char **args, int *orig_arg, struct proxy *px,
+ struct act_rule *rule, char **err)
+{
+ return do_log_parse_act(do_log_http_req, args, orig_arg, px, rule, err);
+}
+
+static enum act_parse_ret parse_http_res_do_log(const char **args, int *orig_arg, struct proxy *px,
+ struct act_rule *rule, char **err)
+{
+ return do_log_parse_act(do_log_http_res, args, orig_arg, px, rule, err);
+}
+
+static enum act_parse_ret parse_http_after_res_do_log(const char **args, int *orig_arg, struct proxy *px,
+ struct act_rule *rule, char **err)
+{
+ return do_log_parse_act(do_log_http_after_res, args, orig_arg, px, rule, err);
+}
+
/************************************************************************/
/* All supported http-request action keywords must be declared here. */
/************************************************************************/
{ "del-map", parse_http_set_map, KWF_MATCH_PREFIX },
{ "deny", parse_http_deny, 0 },
{ "disable-l7-retry", parse_http_req_disable_l7_retry, 0 },
+ { "do-log", parse_http_req_do_log, 0 },
{ "early-hint", parse_http_set_header, 0 },
{ "normalize-uri", parse_http_normalize_uri, KWF_EXPERIMENTAL },
{ "redirect", parse_http_redirect, 0 },
{ "del-header", parse_http_del_header, 0 },
{ "del-map", parse_http_set_map, KWF_MATCH_PREFIX },
{ "deny", parse_http_deny, 0 },
+ { "do-log", parse_http_res_do_log, 0 },
{ "redirect", parse_http_redirect, 0 },
{ "replace-header", parse_http_replace_header, 0 },
{ "replace-value", parse_http_replace_header, 0 },
{ "del-acl", parse_http_set_map, KWF_MATCH_PREFIX },
{ "del-header", parse_http_del_header, 0 },
{ "del-map", parse_http_set_map, KWF_MATCH_PREFIX },
+ { "do-log", parse_http_after_res_do_log, 0 },
{ "replace-header", parse_http_replace_header, 0 },
{ "replace-value", parse_http_replace_header, 0 },
{ "set-header", parse_http_set_header, 0 },
#include <haproxy/action.h>
#include <haproxy/list.h>
#include <haproxy/listener.h>
+#include <haproxy/log.h>
#include <haproxy/obj_type.h>
#include <haproxy/proxy-t.h>
#include <haproxy/quic_sock-t.h>
return ACT_RET_PRS_OK;
}
+static enum log_orig_id do_log_quic_init;
+
+static void init_do_log(void)
+{
+ do_log_quic_init = log_orig_register("quic-init");
+ BUG_ON(do_log_quic_init == LOG_ORIG_UNSPEC);
+}
+
+INITCALL0(STG_PREPARE, init_do_log);
+
+static enum act_parse_ret parse_do_log(const char **args, int *orig_arg,
+ struct proxy *px,
+ struct act_rule *rule, char **err)
+{
+ return do_log_parse_act(do_log_quic_init, args, orig_arg, px, rule, err);
+}
+
static enum act_return quic_init_action_reject(struct act_rule *rule, struct proxy *px,
struct session *sess, struct stream *s, int flags)
{
static struct action_kw_list quic_init_actions = { ILH, {
{ "accept", parse_accept, 0 },
{ "dgram-drop", parse_dgram_drop, 0 },
+ { "do-log", parse_do_log, 0 },
{ "reject", parse_reject, 0 },
{ "send-retry", parse_send_retry, 0 },
{ /* END */ },
#include <haproxy/connection.h>
#include <haproxy/global.h>
#include <haproxy/http_rules.h>
+#include <haproxy/log.h>
#include <haproxy/proto_tcp.h>
#include <haproxy/proxy.h>
#include <haproxy/sample.h>
return ACT_RET_PRS_OK;
}
+static enum log_orig_id do_log_tcp_req_conn;
+static enum log_orig_id do_log_tcp_req_sess;
+static enum log_orig_id do_log_tcp_req_cont;
+static enum log_orig_id do_log_tcp_res_cont;
+
+static void init_do_log(void)
+{
+ do_log_tcp_req_conn = log_orig_register("tcp-req-conn");
+ BUG_ON(do_log_tcp_req_conn == LOG_ORIG_UNSPEC);
+ do_log_tcp_req_sess = log_orig_register("tcp-req-sess");
+ BUG_ON(do_log_tcp_req_sess == LOG_ORIG_UNSPEC);
+ do_log_tcp_req_cont = log_orig_register("tcp-req-cont");
+ BUG_ON(do_log_tcp_req_cont == LOG_ORIG_UNSPEC);
+ do_log_tcp_res_cont = log_orig_register("tcp-res-cont");
+ BUG_ON(do_log_tcp_res_cont == LOG_ORIG_UNSPEC);
+}
+
+INITCALL0(STG_PREPARE, init_do_log);
+
+static enum act_parse_ret tcp_req_conn_parse_do_log(const char **args, int *orig_arg, struct proxy *px,
+ struct act_rule *rule, char **err)
+{
+ return do_log_parse_act(do_log_tcp_req_conn, args, orig_arg, px, rule, err);
+}
+
+static enum act_parse_ret tcp_req_sess_parse_do_log(const char **args, int *orig_arg, struct proxy *px,
+ struct act_rule *rule, char **err)
+{
+ return do_log_parse_act(do_log_tcp_req_sess, args, orig_arg, px, rule, err);
+}
+
+static enum act_parse_ret tcp_req_cont_parse_do_log(const char **args, int *orig_arg, struct proxy *px,
+ struct act_rule *rule, char **err)
+{
+ return do_log_parse_act(do_log_tcp_req_cont, args, orig_arg, px, rule, err);
+}
+
+static enum act_parse_ret tcp_res_cont_parse_do_log(const char **args, int *orig_arg, struct proxy *px,
+ struct act_rule *rule, char **err)
+{
+ return do_log_parse_act(do_log_tcp_res_cont, args, orig_arg, px, rule, err);
+}
static struct action_kw_list tcp_req_conn_actions = {ILH, {
+ { "do-log" , tcp_req_conn_parse_do_log },
{ "set-dst" , tcp_parse_set_src_dst },
{ "set-dst-port", tcp_parse_set_src_dst },
{ "set-fc-mark", tcp_parse_set_mark },
static struct action_kw_list tcp_req_sess_actions = {ILH, {
{ "attach-srv" , tcp_parse_attach_srv },
+ { "do-log", tcp_req_sess_parse_do_log },
{ "set-dst" , tcp_parse_set_src_dst },
{ "set-dst-port", tcp_parse_set_src_dst },
{ "set-fc-mark", tcp_parse_set_mark },
INITCALL1(STG_REGISTER, tcp_req_sess_keywords_register, &tcp_req_sess_actions);
static struct action_kw_list tcp_req_cont_actions = {ILH, {
+ { "do-log", tcp_req_cont_parse_do_log },
{ "set-bc-mark", tcp_parse_set_mark },
{ "set-bc-tos", tcp_parse_set_tos },
{ "set-dst" , tcp_parse_set_src_dst },
INITCALL1(STG_REGISTER, tcp_req_cont_keywords_register, &tcp_req_cont_actions);
static struct action_kw_list tcp_res_cont_actions = {ILH, {
+ { "do-log", tcp_res_cont_parse_do_log },
{ "set-fc-mark", tcp_parse_set_mark },
{ "set-fc-tos", tcp_parse_set_tos },
{ "set-mark", tcp_parse_set_mark }, // DEPRECATED, see set-fc-mark