control mysql & apache logging level

If you want to avoid ‘too many connections’ error due to a full-disk error, you should consider modifying your mysql/apache log settings.

MySQL

First we will check our running log settings, then we will see how to change them permanently.
To do this, we will need the help of ‘mysqladmin’ available within mysql-client package

  1. sudo apt-get install mysql-client-5.1
    update this command to match your mysql version
  2. mysqladmin variables -u mysqlusername -p  | grep log
    then enter your mysql user password when requested
    In my case:

    | log | OFF |
    | log_bin | OFF |
    | log_bin_trust_function_creators | OFF |
    | log_bin_trust_routine_creators | OFF |
    | log_error | /var/lib/mysql/r12925.ovh.net.err |
    | log_output | FILE |
    | log_queries_not_using_indexes | OFF |
    | log_slave_updates | OFF |
    | log_slow_queries | OFF |
    | log_warnings | 1 |

    In my case, log_warnings is set to ‘1’ which leads me to sporadic ‘disk-full’ errors => I will disable log_warnings.

  3. We can disable log_warnings by adding a new line with “log_warnings = 0” into /etc/mysql/my.cnf under [mysqld] section
  4. Restart mysql deamon (sudo /etc/init.d/mysql restart)
  5. Check again your configuration variables as described in step2, my output now is:

    | log_warnings | 0 |

That’s it.

Apache

For apache, simply do the following:

  1. add a new line with “LogLevel crit” into /etc/apache2/http.conf
    apache will log only critical errors (and above)
  2. ensure your configuration is ok, run:
    apache2ctl configtest
  3. if everyting is ok, restart apache:
    sudo /etc/init.d/apache2 restart

That’s it

sources

One Trackback

  1. April 23, 2011 : How to turn off all mysql logs

Post a Comment

Your email is never published nor shared. You're allow to say what you want...