]> git.ipfire.org Git - thirdparty/squid.git/blame - tools/purge/purge.1
SourceFormat Enforcement
[thirdparty/squid.git] / tools / purge / purge.1
CommitLineData
f655a258
GM
1.if !'po4a'hide' .TH purge 8 "October 12, 2014" "" ""
2.
3.SH NAME
4purge \- magnifying glass into your squid cache
5.
6.SH SYNOPSIS
7.if !'po4a'hide' .B purge
8.if !'po4a'hide' .B " [\-a] [\-c cf] [\-d l] [\-(f|F) fn | \-(e|E) re] [\-p h[:p]] [\-P #] [\-s] [\-v] [\-C dir [\-H]] [\-n]"
9.
10.SH DESCRIPTION
11.PP
12.B purge
13is used to have a look at what URLs are stored in which file within
14your cache. The
15.B purge
16tool can also be used to release objects which URLs
17match user specified regular expressions. A more troublesome feature is the
18ability to remove files
19.B squid
20does not seem to know about any longer.
21.PP
77cb5f71 22This is a tool for expert usage only, use it under your own responsibility.
f655a258
GM
23.
24.SH OPTIONS
25.if !'po4a'hide' .TP 12
26.if !'po4a'hide' .B \-a
27a kind of "i am alive" flag. It can only be activated, if
28your stdout is a tty. If active, it will display a little
29rotating line to indicate that there is actually something
30happening. You should not use this switch if you capture
31your stdout in a file or if your expression list produces
32many matches. The \-a flag is also incompatible with the
33(default) multi cache_dir mode.
34.br
35default: off See also: \-n
36.
37.if !'po4a'hide' .TP
38.if !'po4a'hide' .B \-c cd
39this option lets you specify the location of the squid.conf file.
40Purge understands about more than one cache_dir, and does so
41by parsing squid.conf. It knows about both ways of Squid\-2 cache_dir
42specifications, and will automatically try to use the correct one.
43.br
44default: /usr/local/squid/etc/squid.conf
45.
46.if !'po4a'hide' .TP
47.if !'po4a'hide' .B \-C cf
48if you want to rescue files from your cache, you need to specify
49the directory into which the files will be copied. Please note
50that purge will try to establish the original server directory
51structure. This switch also activates copy\-out mode. Please do
52not use copy\-out mode with any purge mode (\-P) other than 0.
53.br
54For instance, if you specified "\-C /tmp", purge will try to
55recreate /tmp/www.server.1/url/path/file, and so forth.
56.br
57default: off See also: \-H, \-P
58.
59.if !'po4a'hide' .TP
60.if !'po4a'hide' .B \-d l
77cb5f71 61lets you specify a debug level. Different bits are reserved for
f655a258
GM
62different output.
63.br
64default: 0
65.
66.if !'po4a'hide' .TP
67.if !'po4a'hide' .B \-e|\-E re
68Specify one regular expression to be searched for in the cache.
69This is useful if there is only a handful of objects you
70want to check. Please remember to escape the shell meta characters
71used in your regular expression. The use of single quotes
72around your expression is recommended. The capital letter
73version works case sensitive, the lower caps version does not.
74.br
75default: (no default)
76.
77.if !'po4a'hide' .TP
78.if !'po4a'hide' .B \-f|\-F fn
79if you have more than a handful of expressions, or want to check
80the same set at regular intervals, the file option might be more
81useful to you. Each line in the text file will be regarded as
82one regular expression. Again, the capital letter version works
83case sensitive, the lower caps version does not.
84.br
85default: (no default)
86.
87.if !'po4a'hide' .TP
88.if !'po4a'hide' .B \-H
89if in copy\-out mode (see: \-C), you can specify to keep the
90HTTP Header in the recreated file.
91.br
92default: off See also: \-C
93.
94.if !'po4a'hide' .TP
95.if !'po4a'hide' .B \-n
96tell purge to process one cache_dir after another,
97instead of doing things in parallel.
98If you have more than one cache_dir in your configuration
99purge will fork off a worker process for each cache_dir to
100do the checks for optimum speed, assuming a decently designed
101cache. Since parallel execution will put quite some load on the
102system and its controllers, it is sometimes preferred to use
103less resources, though it will take longer.
104.br
105default: parallel mode for more than one cache_dir
106.
107.if !'po4a'hide' .TP
108.if !'po4a'hide' .B \-p h[:p]
109Some cache admins use a different port than 3128. The
110purge tool will need to connect to your cache in order to send
111the PURGE request (see \-P). This option lets you specify the
112host and port to connect to. The port is optional. The port
113can be a name (check your /etc/services) or number. It is
114separated from the host name portion by a single colon, no
115spaces allowed.
116.br
117default: localhost:3128
118.
119.if !'po4a'hide' .TP
120.if !'po4a'hide' .B \-P #
121If you want to do more than just print your cache content, you
122will need to specify this option. Each bit is reserved for a
123different action. Only the use of the LSB is recommended, the
124rest should be considered experimental.
125.PP
126.RS
127.B no bit set: just print
128.br
129.B bit#0 set: send PURGE for matches
130.br
131.B bit#1 set: unlink object file for 404 not found PURGEs
132.br
133.B bit#2 set: unlink weird object files
134.RE
135.PP
136If you use a value other than 0 or 1, you will need to slow
137rebuild your cache content. A warning message will remind you
138of that. If you use bit#1, all unsuccessful PURGEs will result
139in the object file in your cache directory to be removed, because
140squid does not seem to know about it any longer. Beware that the
141asyncio might try to remove it after the purge tool, and thus
142complains bitterly. Bit#1 only makes sense, if Bit#0 is also
143set, otherwise it has no effect (since the HTTP status 404 is
144never returned).
145.PP
146Bit#2 is reserved for strange files which do not even contain
147a URL. Beware that these files may indicate a new object squid
148currently intends to swap onto disk. If the file suddenly went
149away, or is removed when squid tries to fetch the object, it
150will complain bitterly. You must slow rebuild your cache, if
151you use this option.
152.PP
153It is recommended that if you dare to use bit#1 or bit#2, you
154should only grant the purge tool access to your squid, e.g.
155move the HTTP and ICP listening port of squid to a different
156non\-standard location during the purge.
157.br
158default: 0 (just print)
159.
160.if !'po4a'hide' .TP
161.if !'po4a'hide' .B \-s
162If you specify this switch, all commandline parameters will be
163shown after they were parsed.
164.br
165default: off
166.
167.if !'po4a'hide' .TP
168.if !'po4a'hide' .B \-v
169be verbose in the things reported about the file. See the output
170section below.
171.
172.SH CONFIGURATION
173.PP
174In order to use
175.B purge
176to affect a running proxy with PURGE method, you will have to enable this feature
177in squid.conf. By default, PURGE is disabled. You should watch closely for whom
178you enable the PURGE ability, otherwise a total stranger just might wipe your
179cache content. Lines similar to the following will need to be added to your squid.conf:
180.if !'po4a'hide' .PP
181.if !'po4a'hide' .RS
182.if !'po4a'hide' .P
183.if !'po4a'hide' .B acl purge method PURGE
184.if !'po4a'hide' .br
185.if !'po4a'hide' .B http_access allow localhost purge
186.if !'po4a'hide' .br
187.if !'po4a'hide' .B http_access deny purge
188.if !'po4a'hide' .RE
189.PP
190Reconfigure or restart (preferred) your squid after changing the
191configuration file.
192.
193.SH OUTPUT
194.PP
195In regular mode, the output of purge consists of four columns. If the
196URL contains not encoded whitespaces, it may look as if there are more
197columns, but the last one is the URI.
198.
199 # name meaning
200 = ====== ===========================================================
201 1 file name of cache file eximed which matches the regular expression.
202 2 status return result of purge request, " 0" in print mode.
203 3 size object size including stored headers, not file size.
204 4 uri perceived uri
205
206Example for non\-verbose output in print\-mode:
207
208/cache3/00/00/0000004A 0 5682 http://graphics.userfriendly.org/images/slovenia.gif
209.
210.PP
211In verbose mode, additional columns are inserted before the uri. Time
212stamps are reported using hexadecimal notation, and Squid's standard
213for reporting "no such timestamp" == \-1, and "unparsable timestamp" == \-2.
214.
215 # name meaning
216 = ====== ===========================================================
217 1 file name of cache file eximed which matches the re.
218 2 status return result of purge request, " 0" in print mode "\-P 0".
219 3 size object size including stored headers, not file size.
220 4 md5 MD5 of URI from file, or "(no_md5_data_available)" string.
221 5 ts UTC of Value of Date: header in hex notation
222 6 lr UTC of last time the object was referenced
223 7 ex UTC of Expires: header
224 8 lr UTC of Last\-Modified: header
225 9 flags Value of objects flags field in hex, see: Programmers Guide
22610 refcnt number of times the object was referenced.
22711 uri STORE_META_URL uri or "strange_file"
228.
229Example for verbose output in print\-mode:
230.
231/cache1/00/00/000000B7 0 406 7CFCB1D319F158ADC9CFD991BB8F6DCE 397d449b 39bf677b ffffffff 3820abfc 0460 1 http://www.netscape.com/images/nc_vera_tile.gif
232.
233.SH KNOWN ISSUES
234Purge does not slow rebuild the cache for you.
235.PP
236It is still relatively slow, especially if your machine is low on memory
237and/or unable to hold all OS directory cache entries in main memory.
238.PP
239Should never be used on "busy" caches with purge modes higher than 1.
240.
241.SH TODO
242.PP
2431) use the stat() result on weird files to have a look at their ctime and
244mtime. If they are younger than, lets say 30 seconds, they were just
245created by
246.B squid
247and should not be removed.
248.PP
2492) Add a query before purging objects or removing files, and add another
250option to remove nagging for the experienced user.
251.PP
2523) The reported object size may be off by one.
253.
254.SH AUTHOR
255This program and manual was written by
256.if !'po4a'hide' .B Santiago Garcia Mantinan <manty@debian.org>
257.if !'po4a'hide' .I Amos Jeffries <amosjeffries@squid-cache.org>
258.PP
259Based on original squidpurge README.
260.
261..SH COPYRIGHT
262.PP
4ac4a490 263 * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
f655a258
GM
264 *
265 * Squid software is distributed under GPLv2+ license and includes
266 * contributions from numerous individuals and organizations.
267 * Please see the COPYING and CONTRIBUTORS files for details.
268.
269.SH QUESTIONS
270Questions on the usage of this program can be sent to the
271.I Squid Users mailing list
272.if !'po4a'hide' <squid-users@squid-cache.org>
273.
274.SH REPORTING BUGS
275See http://wiki.squid-cache.org/SquidFaq/BugReporting for details of what you need to include with your bug report.
276.PP
277Report bugs or bug fixes using http://bugs.squid-cache.org/
278.PP
279Report serious security bugs to
280.I Squid Bugs <squid-bugs@squid-cache.org>
281.PP
282Report ideas for new improvements to the
283.I Squid Developers mailing list
284.if !'po4a'hide' <squid-dev@squid-cache.org>
285.
286.SH SEE ALSO
287.if !'po4a'hide' .BR squid "(8), "
288.if !'po4a'hide' .BR squidclient "(1)"
289.if !'po4a'hide' .BR cachemgr.cgi "(8)"