logformat, User-Agent

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

logformat, User-Agent

Loris Boillet
Hello,

this logformat definition in squid.conf:

logformat combined %>a ... "%{User-Agent}>h"

allow to display the User-Agent string in the squid log:

127.0.0.1 ... "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3)
Gecko/20070310 Iceweasel/2.0.0.3 (Debian-2.0.0.3-1)"

But this string is rather long and I only need a little part of it
(productSub (20070310) for instance). Is there some option that allow to
only display a given part of the User-Agent string in the log ?

Thanks,

Loris

Reply | Threaded
Open this post in threaded view
|

Re: logformat, User-Agent

Henrik Nordström
fre 2007-05-25 klockan 13:09 +0200 skrev Loris Boillet:

> But this string is rather long and I only need a little part of it
> (productSub (20070310) for instance). Is there some option that allow to
> only display a given part of the User-Agent string in the log ?

Not today, but it should be possible to extend the element part to
understand comment fields.

logformat combined %>a ... "%{User-Agent:(productSub}>h"

This would require a new function to extract a comment field based on
it's beginnings, and a slight change in access_log.cc to use this if the
element separator is (

Regards
Henrik

signature.asc (316 bytes) Download Attachment