Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following :

uname -a :

2.6.31-14-generic-pae #48-Ubuntu SMP Fri Oct 16 15:22:42 UTC 2009 i686 GNU/Linux

df -h :

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             9.4G  2.6G  6.4G  29% /
udev                  247M  168K  247M   1% /dev
none                  247M     0  247M   0% /dev/shm
none                  247M   40K  247M   1% /var/run
none                  247M     0  247M   0% /var/lock
none                  247M     0  247M   0% /lib/init/rw
/dev/sda3              40G  5.6G   32G  15% /var/lib/svn

/dev/sda1 is where the webserver is and /dev/sda3 is where we host SVN.

/dev/sda1 is only 10 GB as you can see and some times the apache2 log files become so huge that they take up a lot of space and I see file upload errors. Removing access.log actually takes care of the problem.

Ideally, I want /dev/sda3 to be 25GB and /dev/sda1 25GB but the guys who host this VM say it is really difficult to do that and they say data may be lost and stuff.

I would like to save apache logs on /dev/sda3 instead of /dev/sda1 where they are hosted.

How do I go about doing that? Editing a simple apache .conf file might not do the trick, is it? Thank you!

p.s : I am not a sysadmin!

share|improve this question
up vote 3 down vote accepted

You can configure the location of the log files in apache2 in /etc/httpd/conf/httpd.conf:

 ErrorLog "/var/log/httpd/error_log"

 <IfModule log_config_module>                    
     CustomLog "/var/log/httpd/access_log" common
 </IfModule>

If you feel like too much information is being logged by apache, you can change the log level in /etc/httpd/conf/httpd.conf to warn, crit or alert (please see the apache documentation page for more information on loglevel values):

 LogLevel warn

If that's not enough, you can also modify the logrotate config for apache2 in /etc/logrotate.d/httpd. The logrotate for apache2 is usually configured as a daily cron job.

share|improve this answer
    
Thank you! But how do I reference /dev/sda3 to store the log instead of /dev/sda1? – ThinkCode Sep 25 '12 at 21:14
    
I don't have /etc/httpd but I see /etc/apach2/httpd.conf which is blank. I see apache2.conf though. – ThinkCode Sep 25 '12 at 21:19
    
And, LogLevel is set at warn for now but error.log files are few bytes. Access logs are huge (333MB or so). – ThinkCode Sep 25 '12 at 21:25
1  
1. You could specify the location for CustomLog to a path where /dev/sda3 is mounted such as /var/lib/svn/apache-logs. 2. Ah yes, you would have to configure apache2.conf in that case. 3. You can specify the maximum file size of the access_logs in the logrotate config (and the amount of files that you want logrotate to circle between). – p_strand Sep 25 '12 at 23:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .