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

    Squid doesn't display User Agent in Access Log

    Scheduled Pinned Locked Moved pfSense Packages
    12 Posts 2 Posters 3.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.
    • E
      eskiesirius
      last edited by

      Hi! I have a problem.. when i checked the access_log, there is no user agent.. it only display blank..

      tell me what kind of information you want to know so you can help me in this problem..

      1 Reply Last reply Reply Quote 0
      • KOMK
        KOM
        last edited by

        I think there is only a user displayed if you configured squid to require authentication. It's showing the user, not the browser's user-agent string.

        1 Reply Last reply Reply Quote 0
        • E
          eskiesirius
          last edited by

          ahhh ok.. so it was User not user-agent.. but how can i display the user-agent in access_log?

          1 Reply Last reply Reply Quote 0
          • KOMK
            KOM
            last edited by

            https://wiki.squid-cache.org/Features/LogFormat

            "user The eighth column may contain the user identity for the requesting client. This may be sourced from one of HTTP authentication, an external ACL helper, TLS authentication, or IDENT lookup (RFC 931) - checked in that order with the first to present information displayed. If no user identity is available a "-" will be logged."

            I don't think there is a way to log the user-agent via squid. Why do you need that anyway?

            1 Reply Last reply Reply Quote 0
            • E
              eskiesirius
              last edited by

              for statistics.. our currently setup is that all logs from squid will be send to kibana..

              so i need to create a custom log?

              1 Reply Last reply Reply Quote 0
              • KOMK
                KOM
                last edited by

                I did a minute or two of research and found that squid can indeed log the user-agent but it seems to be disabled by default.

                http://squid-web-proxy-cache.1019090.n4.nabble.com/useragent-log-td4672505.html

                https://www.oreilly.com/library/view/squid-proxy-server/9781849513906/ch05s15.html

                1 Reply Last reply Reply Quote 0
                • E
                  eskiesirius
                  last edited by

                  i already did my research before posting here but sadly.. those links didnt worked for me..

                  1 Reply Last reply Reply Quote 0
                  • KOMK
                    KOM
                    last edited by KOM

                    Works for me. The first link had the solution. Add this to your squid config under Show Advanced Options - Integrations:

                    access_log stdio:/var/squid/logs/useragent.log useragent
                    

                    If you already have something there, append with a ; like this:

                    url_rewrite_program /usr/local/bin/squidGuard -c /usr/local/etc/squidGuard/squidGuard.conf;url_rewrite_bypass off;url_rewrite_children 16 startup=8 idle=4 concurrency=0;access_log stdio:/var/squid/logs/useragent.log useragent
                    
                    1 Reply Last reply Reply Quote 0
                    • E
                      eskiesirius
                      last edited by

                      ok2 thank you i will try this

                      1 Reply Last reply Reply Quote 0
                      • E
                        eskiesirius
                        last edited by eskiesirius

                        anyway i did append useragent so what happened was that.. it only displayed user agent.. the other parameters were removed..

                        1 Reply Last reply Reply Quote 0
                        • KOMK
                          KOM
                          last edited by

                          Yes, it writes it to separate log. You will have to figure out how to ingest useragent.log as well as access.log.

                          1 Reply Last reply Reply Quote 0
                          • E
                            eskiesirius
                            last edited by

                            thank you for that.. i will fix it from here..

                            again thank you for your guidance

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