Re: /bzr/squid3/trunk/ r12048: Bug 3490: Crash writing Referer/Username logs

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Mon, 20 Feb 2012 11:01:54 -0700

On 02/20/2012 01:56 AM, Amos Jeffries wrote:
> ------------------------------------------------------------
> revno: 12048
> message:
> Bug 3490: Crash writing Referer/Username logs
> modified:
> src/log/FormatSquidReferer.cc
> src/log/FormatSquidUseragent.cc

> + // do not log unless there is something to be displayed.
> + if (!al || !al->request)
> + return;
> +
> const char *agent = al->request->header.getStr(HDR_USER_AGENT);
>
> // do not log unless there is something to be displayed.
> if (!agent || *agent == '\0')

I know this and the Log::Format::SquidReferer changes fix a bug and
there is already code that disables logging if agent or referrer are
absent, but I have to note that the "log nothing" approach itself is
flawed because it leads to malformed log entries at best and hides
potentially critical entries at worst, as documented by Squid r11337:

> Log all transactions including those with uncertain status or no sent response.
>
> Excluding those transactions from access log hides valuable information.
>
> For example, it hides certain aborted client transactions which sometimes
> indicate Squid bugs or configuration problems that the administrator can fix.
> It also leads to wrong statistics reporting if the reporting tools are based
> on access logs information.

The correct behavior, IMO, is to log dashes for any information that is
unavailable, even if no information is available for all entries (which
is probably never true for formats that include current time).

Thank you,

Alex.
Received on Mon Feb 20 2012 - 18:02:04 MST

This archive was generated by hypermail 2.2.0 : Tue Feb 21 2012 - 12:00:09 MST