From 97de624c17bc431179aca55b89faa6066f2fea4f Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 27 Dec 2006 17:18:38 +0100 Subject: [PATCH] [MEDIUM] session logging is now defined by the frontend To solve the logging maze, it has been decided that the frontend and nothing else will define how a session will be logged. It might change in the future but at least this choice allows all sort of fantasies. --- src/log.c | 15 +++++++++++---- src/proto_http.c | 7 ++++++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/log.c b/src/log.c index 19cfa99a7..a29223b05 100644 --- a/src/log.c +++ b/src/log.c @@ -302,7 +302,8 @@ void sess_log(struct session *s) * computed. */ - tolog = (fe->to_log | be->to_log | be->beprm->to_log); /* union of all logs */ + /* FIXME: let's limit ourselves to frontend logging for now. */ + tolog = (fe->to_log /*| be->to_log | be->beprm->to_log*/); log = tolog & ~s->logs.logwait; @@ -325,8 +326,14 @@ void sess_log(struct session *s) if (fe->logfac1 >= 0) prx_log = fe; - else if (be->logfac1 >= 0) - prx_log = be; + /* + * FIXME: should we fall back to the backend if the frontend did not + * define any log ? It seems like we should not permit such complex + * setups because they would induce a debugging nightmare for the + * admin. + */ + // else if (be->logfac1 >= 0) + // prx_log = be; else prx_log = NULL; /* global */ @@ -387,7 +394,7 @@ void sess_log(struct session *s) (s->logs.t_queue >= 0) ? s->logs.t_queue - s->logs.t_request : -1, (s->logs.t_connect >= 0) ? s->logs.t_connect - s->logs.t_queue : -1, (s->logs.t_data >= 0) ? s->logs.t_data - s->logs.t_connect : -1, - (be->to_log & LW_BYTES) ? "" : "+", s->logs.t_close, + (tolog & LW_BYTES) ? "" : "+", s->logs.t_close, s->logs.status, (tolog & LW_BYTES) ? "" : "+", s->logs.bytes, s->logs.cli_cookie ? s->logs.cli_cookie : "-", diff --git a/src/proto_http.c b/src/proto_http.c index 83fb1da32..5c26f044a 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -3192,7 +3192,12 @@ void apply_filters_to_session(struct session *t, struct buffer *req, struct hdr_ t->be = target; //t->logs.logwait |= LW_REQ | (target->to_log & (LW_REQHDR | LW_COOKIE)); - t->logs.logwait |= (target->to_log | target->beprm->to_log); + /* FIXME: should we use the backend's log options or not ? + * It would seem far too complicated to configure a service with + * logs defined both in the frontend and the backend. + */ + //t->logs.logwait |= (target->to_log | target->beprm->to_log); + abort_filt = 1; } break;