[squid-users] multiple log_file_daemon settings in squid.conf
Alex Rousskov
rousskov at measurement-factory.com
Tue Mar 20 16:48:05 UTC 2018
On 03/20/2018 04:38 AM, Rafael Akchurin wrote:
> Is there any unique transaction ID in the Squid’s inner workings that I
> can see in the ICAP server, by passing it as additional X-* ICAP header?
Unfortunately, no. %sn comes close to that but due to implementation
bugs and backward compatibility reasons, it is not usable in adaptation
context. You can construct a fairly unique ID using SMP macros, time,
and TCP connection details, but it is not going to be reliable. Master
transaction ID is a missing Squid feature.
The first ICAP REQMOD service that sees the transaction can set this ID,
but ICAP services do not support returning annotations to Squid. Another
missing Squid feature. You might be able to work around this limitation
by using %adapt::<last_h discussed below.
> I can use ICAP header to pass the
> ICAP specific transaction ID back to Squid **and** I can get that ID
> written to Squid’s access log as
> "X-WebSafety-IID=%{X-WebSafety-IID}adapt::<last_h". Is it a valid approach?
I am not sure what your definition of "valid" in this context is, but
this approach probably can be used as a workaround.
Instead of matching Squid access log records and ICAP log records, you
can also tell Squid to log all of the ICAP details into Squid access
log, using the same %adapt::<last_h workaround. No unique IDs or ID
matching is necessary in that case. Whether to put Squid access log
records into a database (instead or in addition to the file) is up to
you, of course.
> Question 3:
>
> If q1 or q2 is answered positively, I still need to somehow get the data
> from squid’s access log the ICAP record database. Currently the idea is
> to have the custom logfile_daemon setting that would fork original
> log_file_daemon to have log entries written to access_log **and** parse
> out the ICAP ID **and** update the corresponding ICAP record in the
> database with transferred bytes information. But this seems complex and
> fragile.
Squid supports multiple access loggers so, yes, you can also add a
non-"daemon" logger that will do the above. Please see Amos response for
details.
HTH,
Alex.
More information about the squid-users
mailing list