Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Squid custom fields

    Scheduled Pinned Locked Moved pfSense Packages
    7 Posts 2 Posters 2.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • X
      xcfd
      last edited by

      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>

      1 Reply Last reply Reply Quote 0
      • M
        mendilli
        last edited by

        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>

        1 Reply Last reply Reply Quote 0
        • X
          xcfd
          last edited by

          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?

          1 Reply Last reply Reply Quote 0
          • M
            mendilli
            last edited by

            there is only the line

            access_log {$logdir_access}

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

            1 Reply Last reply Reply Quote 0
            • X
              xcfd
              last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • M
                mendilli
                last edited by

                @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

                1 Reply Last reply Reply Quote 0
                • X
                  xcfd
                  last edited by

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

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.