Solved

log_slow_queries not working

Posted on 2008-10-10
3
985 Views
Last Modified: 2012-05-05
I'm trying to enable the logging of slow queries on a server...

Here's what I've done:

1. Created a log file : var/log/slowQueryLog.log
2. ran command: touch slowQueryLog.log
3. ran command: chown mysql:mysql slowQueryLog.log
4. Added log_slow_queries to etc/my.cnf (see code below)
5. Stopped and restarted mysql
6. Ran a really long query
7. Checked the log - empty  : (

Am I missing something?
[mysqld]
safe-show-database
innodb_data_file_path=ibdata1:10M:autoextend
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
tmpdir=/var/tmp
 
log_slow_queries=/var/log/slowQueryLog.log
long_query_time=1
 
 
 
#set-variable = sort_buffer_size=4M
#set-variable = query-cache-type = 1
#set-variable = query-cache-size = 20M
#set-variable = key_buffer_size= 64M
#skip-innodb
skip-networking
 
[mysql.server]
user=mysql
basedir=/var/lib			
 
 
 
[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

Open in new window

0
Comment
Question by:susanBuck
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 20

Accepted Solution

by:
Muhammad Wasif earned 500 total points
ID: 22693041
Which mysql version you are using?
Make sure you have only one my.cnf file on the server and you are editing the correct one. Do not use log file name and just define log_slow_queries to see if is it working or not.
0
 

Author Comment

by:susanBuck
ID: 22694814
mysql version 4.1.22

when I run locate my.cnf I get:
/home/ian/.my.cnf
/etc/my.cnf  <<<<<<<<<<< This is the one i'm editing
/etc/my.cnf.rpmsave
/etc/my.cnf.bak
/etc/.my.cnf.swp

Also, when I run my_print_defaults mysqld I get:
--safe-show-database
--innodb_data_file_path=ibdata1:10M:autoextend
--datadir=/var/lib/mysql
--socket=/var/lib/mysql/mysql.sock
--tmpdir=/var/tmp
--log_slow_queries=/var/log/slowQueryLog.log
--long_query_time=1
--skip-networking
Confirming it's in the right place.

Went ahead and did what you said - got rid of the log file name. Restarted apache, ran my long query, then look to see if it created a log anywhere on the server ( "locate slow" )... but nothing...
0
 

Author Comment

by:susanBuck
ID: 22706504
Figured out the problem - I was restarting apache not mysql after making the changes.
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question