Your message has been sent.
This article has been saved to your account.
Go to my account
This article has been emailed to your Kindle.
Send this article
Complete the form below to send this article, Squid Proxy Server: Debugging Problems, to a friend (or to yourself). We will never share your details (or your friend's) with anyone. For more information, read our Privacy Policy.
Squid proxy server enables you to cache your web content and return it quickly on subsequent requests. Though we may take utmost care while configuring Squid and testing everything before deploying changes in production mode, sometimes we may face issues which can affect our clients. The issues may be a result of configuration glitches, Squid bugs, operating system limitations, or even because of the network issues.
In this article by Kulbir Saini, author of Squid Proxy Server 3 Beginners Guide, we will discuss some debugging problems which we may come across while configuring or running Squid.
| Read more about this book |
(For more resources on Proxy Servers, see here.)
Mostly, we encounter problems that are well-known and are a result of configuration glitches or operating system limitations. So, those problems can be fixed easily by tweaking configuration files. However, sometimes we may face problems that cannot be solved directly or we may not even be able to identify them by simply looking at the log files.
By default, Squid only logs the essential information to cache.log. To inspect or debug problems, we need to increase the verbosity of the logs so that Squid can tell us more about the actions it's taking, which may help us find the source of the problem. We can extract information from Squid about its actions at our convenience by using the debug_options directive in the Squid configuration file.
Let's have a look at the format of the debug_options directive:
debug_options rotate=N section,verbosity [section,verbosity]...
The parameter rotate (rotate=N) specifies the number of cache.log files that will be maintained when Squid logs are rotated. The default value of N is 1. The rotate option helps in preventing disk space from being wasted due to excessive log messages when the verbosity level is high.
The parameter section is an integer identifying a particular component of Squid. It can have a special value, ALL, which represents all components of Squid. The verbosity parameter is also an integer representing the verbosity level for each section. Let's have a look at the meaning of different verbosity levels:
| Verbosity level | Description |
| 0 | Only critical or fatal messages will be logged. |
| 1 | Warnings and important problems will be logged. |
| 2 | At verbosity level 2, the minor problems, recovery, and regular high-level actions will be logged. |
| 3-5 | Almost everything useful is covered by verbosity level 5. |
| 6-9 | Above verbosity level 5, it is extremely verbose. Individual events, signals, and so on are described in detail. |
The following is the default configuration:
debug_options rotate=1 ALL,1
The preceding configuration line sets the verbosity level for all sections of Squid to 1, which means that Squid will try to log the minimum amount of information possible.
The section number can be determined by looking at the source of the file. In most source files, we can locate a commented line, as shown in the following example, which is from access_log.cc:
/*
...
* DEBUG: section 46 Access Log
...
*/
The previous comment tells us that the section number for the Access Log is 46. A list of section numbers and corresponding Squid components can be found at doc/debug-sections.txt in Squid's source code. The following table represents some of the important section numbers for Squid version 3.1.10:
| Section number | Squid components |
| 0 | Announcement Server, Client Database, Debug Routines, DNS Resolver Daemon, UFS Store Dump Tool |
| 1 | Main Loop, Startup |
| 2 | Unlink Daemon |
| 3 | Configuration File Parsing, Configuration Settings |
| 4 | Error Generation |
| 6 | Disk I/O Routines |
| 9 | File Transfer Protocol (FTP) |
| 11 | Hypertext Transfer Protocol (HTTP) |
| 12 | Internet Cache Protocol (ICP) |
| 14 | IP Cache, IP Storage, and Handling |
| 15 | Neighbor Routines |
| 16 | Cache Manager Objects |
| 17 | Request Forwarding |
| 18 | Cache Manager Statistics |
| 20 | Storage Manager, Storage Manager Heap-based replacement, Storage Manager Logging Functions, Storage Manager MD5 Cache Keys, Storage Manager Swapfile Metadata, Storage Manager Swapfile Unpacker, Storage Manager Swapin Functions, Storage Manager Swapout Functions, Store Rebuild Routines, Swap Dir base object |
| 23 | URL Parsing, URL Scheme parsing |
| 28 | Access Control |
| 29 | Authenticator, Negotiate Authenticator, NTLM Authenticator |
| 31 | Hypertext Caching Protocol |
| 32 | Asynchronous Disk I/O |
| 34 | Dnsserver interface |
| 35 | FQDN Cache |
| 44 | Peer Selection Algorithm |
| 46 | Access Log |
| 50 | Log file handling |
| 51 | Filedescriptor Functions |
| 55 | HTTP Header |
| 56 | HTTP Message Body |
| 57 | HTTP Status-line |
| 58 | HTTP Reply (Response) |
| 61 | Redirector |
| 64 | HTTP Range Header |
| 65 | HTTP Cache Control Header |
| 66 | HTTP Header Tools |
| 67 | String |
| 68 | HTTP Content-Range Header |
| 70 | Cache Digest |
| 71 | Store Digest Manager |
| 72 | Peer Digest Routines |
| 73 | HTTP Request |
| 74 | HTTP Message |
| 76 | Internal Squid Object handling |
| 78 | DNS lookups, DNS lookups; interacts with lib/rfc1035.c |
| 79 | Disk IO Routines, Squid-side DISKD I/O functions, Squid-side Disk I/O functions, Storage Manager COSS Interface, Storage Manager UFS Interface |
| 84 | Helper process maintenance |
| 89 | NAT / IP Interception |
| 90 | HTTP Cache Control Header, Storage Manager Client-Side Interface |
| 92 | Storage File System |
Summary
In this article we took a look at some debugging problems which we may come across while configuring or running Squid.
Further resources on this subject:
- Squid Proxy Server: Tips and Tricks [Article]
- Squid Proxy Server 3: Getting Started [Article]
- Configuring Squid to Use DNS Servers [Article]
- Different Ways of Running Squid Proxy Server [Article]
- Squid Proxy Server: Fine Tuning to Achieve Better Performance [Article]
About the Author :
Kulbir Saini
Kulbir Saini is an entrepreneur based in Hyderabad, India. He has had extensive experience in managing systems and network infrastructure. Apart from his work as a freelance developer, he provides services to a number of startups. Through his blogs, he has been an active contributor of documentation for various open source projects, most notable being The Fedora Project and Squid. Besides computers, which his life practically revolves around, he loves travelling to remote places with his friends. For more details, please check http://saini.co.in/.




Post new comment