Koozali.org: home of the SME Server

How to purge SARG reports (and other log files)

Offline Frank VB

  • ***
  • 127
  • +0/-0
How to purge SARG reports (and other log files)
« on: December 19, 2006, 03:33:43 PM »
Hello

I know a little bit about Linux commands but I'm new to SME server. I have a SME 6.0 server with a 40 GB drive which is almost completely filled up. I've read that you can purge the SARG report files, located at /var/www/html/squid, (which eat up a lot of disk space). How do I this? Log in as root, browse to the folder and execute a delete command?

Are there any other (log) files that I can delete safely? Is there a command to defrag the hard drive?

Thanks for your help.

Frank

Offline byte

  • *
  • 2,183
  • +2/-0
How to purge SARG reports (and other log files)
« Reply #1 on: December 22, 2006, 11:47:30 PM »
What I normally do is take a backup of the data then delete within the daily/weekly/monthly directories, you can do this using the rm command but do take care using it have a go on a test box first and type man rm at command to see the different syntax;s
--[byte]--

Have you filled in a Bug Report over @ http://bugs.contribs.org ? Please don't wait to be told this way you help us to help you/others - Thanks!

Offline Frank VB

  • ***
  • 127
  • +0/-0
Archiving
« Reply #2 on: January 04, 2007, 03:11:28 PM »
Thanks. Ultimately I did the following:

1. First I navigated to the daily log folder:

Code: [Select]
cd /var/www/html/squid/daily

Note: you should log in with the root account.

2. I archived all the subfolders and files in the daily folder into a file named "daily.2003.tar.gz" with the command:

Code: [Select]
tar zcvf daily.2003.tar.gz ./2003*-2003*

I repeated step 2 for every year that I wanted to archive. Actually I archived the years 2003 and 2004. So:

Code: [Select]
tar zcvf daily.2004.tar.gz ./2004*-2004*

2. I then moved all the resulting tar files to my home folder:

Code: [Select]
mv 2003*.tar.gz -v /home/e-smith/files/users/[myusername]/home/squidlogs/daily
mv 2004*.tar.gz -v /home/e-smith/files/users/[myusername]/home/squidlogs/daily


Note: You should substitute [myusername] with your user account. Also, be sure to first create a folder squidlogs with a subfolder daily before executing the move command!

3. It is advisable that you also backup the index.html files in the daily, weekly and monthly folders. You can simply copy those files. For example:

Code: [Select]
cp index.html /home/e-smith/files/users/[myusername]/home/squidlogs/daily

4. You can move the tar files to an external or local hard drive.

5. Finally, I removed all the original files in the /var/www/html/squid/daily folder with:

Code: [Select]
rm -rf 2003*
rm -rf 2004*


6. I did the same thing in the weekly and monthly folders. As a result I gained approximately 3.3 G of hard disk space (which is a lot on a 40 G disk)!

I hope this will help other people with cleaning up their hard disks.

Frank