MINOR: spoe: Add support for option dontlog-normal in the SPOE agent section

It does the same than for proxies.
This commit is contained in:
Christopher Faulet 2018-03-26 17:20:36 +02:00 committed by Willy Tarreau
parent 7250b8fb5c
commit 0e0f085a73
2 changed files with 27 additions and 0 deletions

View File

@ -172,6 +172,7 @@ spoe-agent <name>
- max-waiting-frames - max-waiting-frames
- messages - messages
- [no] option async - [no] option async
- [no] option dontlog-normal
- [no] option pipelining - [no] option pipelining
- [no] option send-frag-payload - [no] option send-frag-payload
- option continue-on-error - option continue-on-error
@ -260,6 +261,16 @@ option continue-on-error
When set, this option bypass this behaviour and only the current event will When set, this option bypass this behaviour and only the current event will
be ignored. be ignored.
option dontlog-normal
no option dontlog-normal
Enable or disable logging of normal, successful processing.
Arguments : none
See also: "log" and section 4 about logging.
option force-set-var option force-set-var
By default, SPOE filter only register already known variables (mainly from By default, SPOE filter only register already known variables (mainly from
parsing of the configuration). If you want that haproxy trusts the agent and parsing of the configuration). If you want that haproxy trusts the agent and

View File

@ -94,6 +94,10 @@ struct list curvars;
/* list of log servers used during the parsing */ /* list of log servers used during the parsing */
struct list curlogsrvs; struct list curlogsrvs;
/* agent's proxy flags (PR_O_* and PR_O2_*) used during parsing */
int curpxopts;
int curpxopts2;
/* Pools used to allocate SPOE structs */ /* Pools used to allocate SPOE structs */
static struct pool_head *pool_head_spoe_ctx = NULL; static struct pool_head *pool_head_spoe_ctx = NULL;
static struct pool_head *pool_head_spoe_appctx = NULL; static struct pool_head *pool_head_spoe_appctx = NULL;
@ -3461,6 +3465,14 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
curagent->flags |= SPOE_FL_SND_FRAGMENTATION; curagent->flags |= SPOE_FL_SND_FRAGMENTATION;
goto out; goto out;
} }
else if (!strcmp(args[1], "dontlog-normal")) {
if (alertif_too_many_args(1, file, linenum, args, &err_code))
goto out;
if (kwm == 1)
curpxopts2 &= ~PR_O2_NOLOGNORM;
else
curpxopts2 |= PR_O2_NOLOGNORM;
}
/* Following options does not support negation */ /* Following options does not support negation */
if (kwm == 1) { if (kwm == 1) {
@ -3983,6 +3995,8 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px,
LIST_INIT(&curgphs); LIST_INIT(&curgphs);
LIST_INIT(&curvars); LIST_INIT(&curvars);
LIST_INIT(&curlogsrvs); LIST_INIT(&curlogsrvs);
curpxopts = 0;
curpxopts2 = 0;
conf = calloc(1, sizeof(*conf)); conf = calloc(1, sizeof(*conf));
if (conf == NULL) { if (conf == NULL) {
@ -4306,6 +4320,8 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px,
init_new_proxy(&conf->agent_fe); init_new_proxy(&conf->agent_fe);
conf->agent_fe.id = conf->agent->id; conf->agent_fe.id = conf->agent->id;
conf->agent_fe.parent = conf->agent; conf->agent_fe.parent = conf->agent;
conf->agent_fe.options |= curpxopts;
conf->agent_fe.options2 |= curpxopts2;
list_for_each_entry_safe(logsrv, logsrvback, &curlogsrvs, list) { list_for_each_entry_safe(logsrv, logsrvback, &curlogsrvs, list) {
LIST_DEL(&logsrv->list); LIST_DEL(&logsrv->list);