On Wed, 20 Jan 1999, Jim Robertson wrote:
]In Squid 1.1.20 I have a perl script that extracts URL and filesize
]information from the swap log file and being a text file this is fairly
]straight forward.
]
]The trouble is though that in Squid 2.X, the swap log file (swap.state) is
]now in a binary format.
]
]Looking for an alternative method, I found the "All Cache Objects" option in
]cachemgr.cgi but it doesn't seem to be listing as it's name suggests all
]objects in the cache (perhaps I misunderstand its meaning).
]
]Can anybody please help me with how from a perl script could I extract URL
]and filesizes from the new binary "swap.state" file?
]Or otherwise get this info from Squid somehow.
A while ago there was something seemingly unrelated on squid-users. Mark
Reynolds and I worked on a script PURGEing objects from a cache. As a
byproduct of jetting over each file in your cache directory, the metadata
could be extracted.
Since then, I ported the perl script to C++ (ok, it's more C than C++),
and if you just intend to extract the filename, related URL stored within
and object size (including the HTTP header), you could use the (default)
print option of the program with the '.' (match all) regular expression:
$ ./purge -e .
### Use at your own risk! No guarantees whatsoever. You were warned. ###
[...]
/var/spool/cache/00/02/0000011B 0 6022 http://www.jpl.nasa.gov/ice_fire/sprobe.htm
[... many more lines ...]
The first column shows the cache file, the second column the HTTP purge
result (we just printed, no purges done, thus no HTTP results), the third
column the object size including stored headers, and the final column the
URL stored within. *** Treat it as experimental *** If you want to purge
objects, I suggest that you do not use purge modes higher than 1.
http://statistics.www-cache.dfn.de/Projects/purge/
Use at your own risk!
Le deagh dh�rachd,
Dipl.-Ing. Jens-S. V�ckler (voeckler@rvs.uni-hannover.de)
Institute for Computer Networks and Distributed Systems
University of Hanover, Germany; +49 511 762 4726
Received on Wed Jan 20 1999 - 03:35:12 MST
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:44:05 MST