[BUG]: Restore clearing t->logs.bytes

Commit 8b3977ffe3 removed "t->logs.bytes_in = 0;"
but instead it should change it into "t->logs.bytes_out = 0;" as since
583bc96606 counters are incremented not set.

It should be incremented in session_process_counters while sending data to a
client:
        bytes = s->rep->total - s->logs.bytes_out;
        s->logs.bytes_out = s->rep->total;

However, if we increment (set) s->logs.bytes_out while processing
"logasap", statistics get wrong values added for headers: 0 or even
negative if haproxy adds some headers itself.

To test it, please enable logasap and download one empty file and look at
stats. Without my fix information available on that page are invalid, for
example:

# pxname,svname,qcur,qmax,scur,smax,slim,stot,bin,bout,dreq,dresp,ereq,econ,eresp,wretr,wredis,status,weight,act,bck,chkfail,chkdown,lastchg,downtime,qlimit,pid,iid,sid,throttle,lbtot,
www,b,0,0,0,1,,1,24,-92,,0,,0,0,0,,UP,1,1,0,0,0,3121,0,,1,2,1,,1,
www,BACKEND,0,0,0,1,0,1,24,-92,0,0,,0,0,0,0,UP,1,1,0,,0,3121,0,,1,2,0,,1,
This commit is contained in:
Krzysztof Piotr Oledzki 2008-01-20 23:27:02 +01:00 committed by Willy Tarreau
parent 0f68eaca1a
commit f1e1cb463f

View File

@ -3126,7 +3126,9 @@ int process_srv(struct session *t)
} }
#endif #endif
/* if the user wants to log as soon as possible, without counting /* if the user wants to log as soon as possible, without counting
bytes from the server, then this is the right moment. */ * bytes from the server, then this is the right moment. We have
* to temporarily assign bytes_out to log what we currently have.
*/
if (t->fe->to_log && !(t->logs.logwait & LW_BYTES)) { if (t->fe->to_log && !(t->logs.logwait & LW_BYTES)) {
t->logs.t_close = t->logs.t_data; /* to get a valid end date */ t->logs.t_close = t->logs.t_data; /* to get a valid end date */
t->logs.bytes_out = txn->rsp.eoh; t->logs.bytes_out = txn->rsp.eoh;
@ -3134,6 +3136,7 @@ int process_srv(struct session *t)
http_sess_log(t); http_sess_log(t);
else else
tcp_sess_log(t); tcp_sess_log(t);
t->logs.bytes_out = 0;
} }
/* Note: we must not try to cheat by jumping directly to DATA, /* Note: we must not try to cheat by jumping directly to DATA,