Combine multiple squid access.log files

We have squid cache / proxy running on a number of Windows servers in diffident geographical locations with the access.log file on the local server in each location. The problem was our reporting software LightSquid was in one location and needed a single access.log file.

To solve this problem I created a simple script and scheduled it to run every hour. The script collects the remote access.log files and combines them into one access.log then uploads the access.log to the Linux box running LightSquid for processing.

Here are the contents of the two files cp.bat (schedule this one to run hourly) and squid.ftp, create a folder called c:\AccessLogCP and put the two files in it.

Contents of cp.bat (change the server and folders names suite your setup)

::Copy squid log files from remote systems
copy \\srv01\c$\squid\var\logs\access.log c:\AccessLogCP\srv01.txt
copy \\srv02\c$\squid\var\logs\access.log c:\AccessLogCP\srv02.txt

::Delete old access.log file
del /Q access.log

::Combine or pipe the contents of all files that end in txt to access.log
type *.txt >> access.log

::Delete the txt files as we are finished with them
del /Q *.txt

::FTP access.log to lihtsquid for processing
c:\windows\system32\ftp.exe -s:squid.ftp


Contents of squid.ftp (change, yourftp, yourusername and yourpassword names suite your setup)

open yourftp