Squid custom fields



  • I am trying pfsense in a vm and was wondering if its it possible to set custom fields in squid 3.0 on pfsense.  I have tried setting new fields in custom options but that has not worked.  By default pfsense had the following in the conf file:

    access_log /var/squid/log/access.log

    In the custom options portion I have tried to add multiple different things such as:

    logformat squid %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %>Hs %<st "%{referer}="">h" "%{User-Agent}>h" %Ss:%Sh
    logformat squidmime %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %>Hs %<st "%{referer}="">h" "%{User-Agent}>h" %Ss:%Sh
    logformat common %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %>Hs %<st "%{referer}="">h" "%{User-Agent}>h" %Ss:%Sh
    logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %>Hs %<st "%{referer}="">h" "%{User-Agent}>h" %Ss:%Sh

    Nothing seems to work.  I am not sure if I am doing something wrong.  Is this config possible? </st></st></st></st>



  • you have to change the corresponding lines in /usr/local/pkg/squid.inc file like below and save it on the squid configuration page

    logformat custom_name %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %>Hs %<st "%{referer}="">h" "%{User-Agent}>h" %Ss:%Sh
    access_log {$logdir_access} custom_name

    if you do it from custom options multiple logformat setting will be created and it can can break your squid setup</st>



  • Thank you very much for you reply.  I looked at the squid.inc file under /usr/local/pkg/squid.inc but I was unable to find the corresponding logformat line in the file.  Is there a particular spot that I have place my custom line?



  • there is only the line

    access_log {$logdir_access}

    in default inc file, you should replace it with the ones I gave,



  • Thanks for you reply.  The solution you provided works!  The only problem I ran into was putting %Hs into the config.  If you do squid has a parsing error.  If you take it works perfect.



  • @xcfd:

    Thanks for you reply.  The solution you provided works!  The only problem I ran into was putting %Hs into the config.  If you do squid has a parsing error.  If you take it works perfect.

    I think it is something about squid version try %>Hs



  • I found that just %Hs work and puts in the status code.  I really appreciate your help.  It seems that everything is working now.


Log in to reply