On 5-1-2010 16:49, Roland Roland wrote: > Hello, > > i'm looking to do the following hope someone could help me if its > actually feasible.. > each day at 8 AM, i want access.log to be renamed to > access.log.DateOfPreviousDay > that way on any given day access.log would only contains hits of the > current day.. > the reason i want this, is that i have SARG set to read everything from > /var/log/squid/access.log and outputs it in a nice graphical interface.. > though the problem is that i have hits from every day appended to the > hits of the previous day hence the request above.. > hope this all makes sense to you... > > thanks in advance:) > And what is your exact question? I have a script to rotate my logs every night as well on my FreeBSD boxes. I don't know what the problem is you are experiencing, but it might give you some inspiration: (you have to fix the line breaks yourself): -------------------------------------------- #!/bin/sh set -e yesterday_secs=`perl -e 'print time -43200'` yesterday_date=`date -r $yesterday_secs +%Y%m%d` cd /usr/local/squid/logs/ # rename the current log file without interrupting the logging process mv /usr/local/squid/logs/access.log /usr/local/squid/logs/access.log.$yesterday_date mv /usr/local/squid/logs/store.log /usr/local/squid/logs/store.log.$yesterday_date mv /usr/local/squid/logs/cache.log /usr/local/squid/logs/cache.log.$yesterday_date # tell Squid to close the current logs and open new ones /usr/local/sbin/squid -k rotate # give Squid some time to finish writing swap.state files /bin/sleep 30 mv /usr/local/squid/logs/access.log.$yesterday_date /usr/local/squid/logs/archive/ mv /usr/local/squid/logs/store.log.$yesterday_date /usr/local/squid/logs/archive/ mv /usr/local/squid/logs/cache.log.$yesterday_date /usr/local/squid/logs/archive/ gzip -9 /usr/local/squid/logs/archive/access.log.$yesterday_date gzip -9 /usr/local/squid/logs/archive/store.log.$yesterday_date gzip -9 /usr/local/squid/logs/archive/cache.log.$yesterday_date chmod 666 /usr/local/squid/logs/archive/* -------------------------------------------- -- With kind regards, Angelo Höngens systems administrator MCSE on Windows 2003 MCSE on Windows 2000 MS Small Business Specialist ------------------------------------------ NetMatch tourism internet software solutions Ringbaan Oost 2b 5013 CA Tilburg +31 (0)13 5811088 +31 (0)13 5821239 A.Hongens@xxxxxxxxxxx www.netmatch.nl ------------------------------------------