• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
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 Feb 21, 2019, 3:52 PM

    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
    • K
      KOM
      last edited by Feb 21, 2019, 8:29 PM

      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 Feb 21, 2019, 11:55 PM

        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
        • K
          KOM
          last edited by Feb 22, 2019, 2:05 PM

          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 Feb 22, 2019, 2:38 PM

            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
            • K
              KOM
              last edited by Feb 22, 2019, 2:43 PM

              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 Feb 22, 2019, 2:46 PM

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

                1 Reply Last reply Reply Quote 0
                • K
                  KOM
                  last edited by KOM Feb 22, 2019, 3:08 PM Feb 22, 2019, 3:07 PM

                  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 Feb 22, 2019, 3:20 PM

                    ok2 thank you i will try this

                    1 Reply Last reply Reply Quote 0
                    • E
                      eskiesirius
                      last edited by eskiesirius Feb 22, 2019, 3:29 PM Feb 22, 2019, 3:29 PM

                      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
                      • K
                        KOM
                        last edited by Feb 22, 2019, 3:39 PM

                        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 Feb 22, 2019, 3:40 PM

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

                          again thank you for your guidance

                          1 Reply Last reply Reply Quote 0
                          12 out of 12
                          • First post
                            12/12
                            Last post
                          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                            This community forum collects and processes your personal information.
                            consent.not_received