0

I was running my Apache server on RHEL 5.5, and noticed when I typed: df -h, that I was getting:

[root@localhost log]# df -h
Filesystem            Size      Used   Avail  Use%   Mounted on
/dev/mapper/VolGroup00-LogVol00
                      11G       11G    0      100%   /
/dev/sda1             99M       13M    82M    14%    /boot
tmpfs                 1006M     0      1006M  0%     /dev/shm

Any idea where the space would be going to?

I have cleaned out the log files in /usr/local/apache2/logs/, but that hasn't cleaned up the space.

It has got to be a log file somewhere, but I can't find it.

Is there a command I can use to search / for the large files?

I have tried:

# du -a /var | sort -n -r | head -n 10

No luck.

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
Kevdog777
  • 3,224
  • 4
    As well as removing the log files, did you restart apache? Until you do, the kernel won't be able to free the disk space they occupied. – D_Bye Aug 27 '14 at 08:09
  • Thanks @D_Bye, I had to restart the Apache Server, and that worked. – Kevdog777 Aug 27 '14 at 08:31
  • Is there any way I can switch off logging on the server now? I commented the lines out in the httpd.conf file. – Kevdog777 Aug 27 '14 at 08:32
  • 1
    See here on how to find the large files and/or directories: http://unix.stackexchange.com/questions/140367/finding-all-large-files-in-the-root-filesystem – slm Aug 27 '14 at 08:54
  • 1
    @Kevdog777 That should do it. – D_Bye Aug 27 '14 at 10:29
  • I'd advise against disabling logging entirely – tools like logrotate can help you keep only logs for the last 3 days or whatever you like. It's a lot less trouble than having to re-enable logging when you already have a problem with your server. – Ulrich Schwarz Aug 27 '14 at 12:30
  • Thanks @UlrichSchwarz, but as this is not a production server and is only used for testing our software against, its ok to not have logging enabled - once the server is up and running, that's all that we need :) – Kevdog777 Aug 27 '14 at 12:32

1 Answers1

0

The issue was that Apache was still writing to a certain log file: access_log. I commented that out, using the # tag, and after running a full weekend using the Apache server, it did not run out of space.

I typed: df -h on Friday and got this:

[root@localhost logs]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       11G  9.3G  817M  93% /
/dev/sda1              99M   13M   82M  14% /boot
tmpfs                1006M     0 1006M   0% /dev/shm

Then this morning (Monday), I typed: df -h and got this:

[root@localhost logs]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                       11G  9.3G  816M  93% /
/dev/sda1              99M   13M   82M  14% /boot
tmpfs                1006M     0 1006M   0% /dev/shm

For me to find the other log file, I had to:

[root@localhost conf]# grep access_log httpd.conf 
# with "/", the value of ServerRoot is prepended -- so 'log/access_log'
# server as '/www/log/access_log', where as '/log/access_log' will be
# interpreted as '/log/access_log'.
    CustomLog "logs/access_log" common
    #CustomLog "logs/access_log" combined

As you can see, CustomLog "logs/access_log" common is not commented out. That file gets really big.

Kevdog777
  • 3,224