/var/log & disk usage

Alk

Verified User
Joined
Jun 30, 2005
Messages
13
Hi
We are running out of disk space, (OS: CentOS) so I'm looking at some of the disk space being used.
  1. Firstly, we have 17GBs of /var/log. Here is a breakdown:
    [root@server1 log]# du -sh *
    972K apf_log
    24K apf_log.1
    0 audit
    12K audit.d
    4.0K bfd_log
    4.0K bfd_log.1
    1.2M boot.log
    4.0K boot.log.1
    153M cron
    2.9M cron.1
    21M directadmin
    16K dmesg
    15G exim :o
    518M httpd
    532K kernel
    652K kernel.1
    88K ksyms.0
    88K ksyms.1
    88K ksyms.2
    88K ksyms.3
    88K ksyms.4
    88K ksyms.5
    88K ksyms.6
    19M lastlog
    160K login_log
    164K login_log.1
    8.0K mail
    42M maillog
    1.3M maillog.1
    287M messages
    5.6M messages.1
    12K mysql
    907M mysqld.log
    202M proftpd
    44K rkhunter.log
    16K rpmpkgs
    16K rpmpkgs.1
    4.0K samba
    107M secure
    1.1M secure.1
    0 spooler
    0 spooler.1
    4.0K squid
    0 up2date
    0 up2date.1
    4.0K vbox
    8.5M wtmp
    1.3M wtmp.1
    What can we do about that size of logs please? :confused:
  2. The last thing is (I don't even know what these are or do), can any of these be brought down in size?
  3. /usr/lib 479mb
  4. /usr/local 426mb
  5. /usr/share 475mb
    [/list=1]
    NB: We are using 29GB of mysql mainly from our main site which uses 20GB in 1 database.
    Thank you!
 
You should setup logrotate to rotate the logs such as exim. They shouldn't be taking that much space.
 
What can I do about it?

jmstacey said:
You should setup logrotate to rotate the logs such as exim. They shouldn't be taking that much space.
What can I do about the files? can I delete them? I don't want 15GB of logs!
Thanks
 
Yes you can delete them but you will most likely need to restart those services to have them create a new log file and start logging again.
 
In fact, Jon, deleting them will only delete the directory entries. Here's the proper series of steps to take (on RH Linux, CentOS, or RHEL):
Code:
# rm -f /var/log/exim/mainlog*
# rm -f /var/log/exim/rejectlog*
# touch /var/log/exim/mainlog
# touch /var/log/exim/rejectlog
# service exim restart
Jeff
 
jlasman said:
In fact, Jon, deleting them will only delete the directory entries. Here's the proper series of steps to take (on RH Linux, CentOS, or RHEL):
Code:
# rm -f /var/log/exim/mainlog*
# rm l-f /var/log/exim/rejectlog*
# touch /var/log/exim/mainlog
# touch /var/log/exim/rejectlog
# service exim restart
Jeff
You are a genius, thank you so much.:D I really appreciate you giving me the commands I have to enter to achieve it as I say, I am a newbie.
Thank you to both of you for your excellent help! (better than other cpanel providers :cool: ).
 
I just noticed an error in my code :( .

Please look above at my post again (I edited it).

It's rm -f and not rm l-f.

My finger's gotten lazy :rolleyes: .

Jeff
 
Thank you, that worked a treat. :)

On a similar topic, I am trying to delete some mysql bin files to free about 7GB of space.
Now, I believe that the correct way to do this is to use RESET MASTER?
Well, I tried it and I got an error:

[root@server1 tmpmysqlbin2]# mysql -u da_admin -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 387159 to server version: 4.0.23-standard

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> RESET MASTER;
ERROR 1186: Binlog closed, cannot RESET MASTER
I am becoming worried about what I am doing now! So any step by step of the commands needed would be appreciated as I know nothing!
Thanks!:)
 
I don't know what RESET MASTER means I'm not a MySQL guru.

Do you mean you want to remove complete MySQL databases?

Jeff
 
Back
Top