MINOR: log: add a new flag 'L' for locally processed requests
People who use "option dontlog-normal" are bothered with redirects and
stats being logged and reported as errors in the logs ("PR" = proxy
blocked the request).
This patch introduces a new flag 'L' for when a request is locally
processed, that is not considered as an error by the log filters. That
way we know a request was intercepted and processed by haproxy without
logging the line when "option dontlog-normal" is in effect.
diff --git a/src/log.c b/src/log.c
index 020c381..627351f 100644
--- a/src/log.c
+++ b/src/log.c
@@ -54,7 +54,7 @@
"warning", "notice", "info", "debug"
};
-const char sess_term_cond[16] = "-cCsSPRIDKUIIIII"; /* normal, CliTo, CliErr, SrvTo, SrvErr, PxErr, Resource, Internal, Down, Killed, Up, -- */
+const char sess_term_cond[16] = "-LcCsSPRIDKUIIII"; /* normal, Local, CliTo, CliErr, SrvTo, SrvErr, PxErr, Resource, Internal, Down, Killed, Up, -- */
const char sess_fin_state[8] = "-RCHDLQT"; /* cliRequest, srvConnect, srvHeader, Data, Last, Queue, Tarpit */
@@ -1516,9 +1516,11 @@
int size, err, level;
/* if we don't want to log normal traffic, return now */
- err = (s->flags & (SN_ERR_MASK | SN_REDISP)) ||
- (s->req->cons->conn_retries != s->be->conn_retries) ||
- ((s->fe->mode == PR_MODE_HTTP) && s->txn.status >= 500);
+ err = (s->flags & SN_REDISP) ||
+ ((s->flags & SN_ERR_MASK) > SN_ERR_LOCAL) ||
+ (((s->flags & SN_ERR_MASK) == SN_ERR_NONE) &&
+ (s->req->cons->conn_retries != s->be->conn_retries)) ||
+ ((s->fe->mode == PR_MODE_HTTP) && s->txn.status >= 500);
if (!err && (s->fe->options2 & PR_O2_NOLOGNORM))
return;