mysqldumpslow looking for slow.log file on an incorrect directory

Bug #819535 reported by Dax Solomon Umaming
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
mysql-8.0 (Ubuntu)
In Progress
Low
Lena Voytek

Bug Description

when executing mysqldumpslow without arguments, the response I get is:
Can't find '/var/lib/mysql/*-slow.log'
when it should look for the slow log file at /var/log/mysql/mysql-slow.log

I understand that the tool should be executed with argument pointing to the correct log file location, but if that is the case, then we should also change the response from
Can't find '/var/lib/mysql/*-slow.log'
to
Missing argument, see --help or man
or something like that

ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: mysql-client 5.1.54-1ubuntu4
ProcVersionSignature: Ubuntu 2.6.38-10.46-generic 2.6.38.7
Uname: Linux 2.6.38-10-generic x86_64
NonfreeKernelModules: nvidia
Architecture: amd64
Date: Tue Aug 2 05:32:24 2011
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release amd64 (20110427.1)
PackageArchitecture: all
ProcEnviron:
 LANGUAGE=en_PH:en
 PATH=(custom, user)
 LANG=en_PH.UTF-8
 SHELL=/bin/bash
SourcePackage: mysql-5.1
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Dax Solomon Umaming (knightlust) wrote :
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Thanks for reporting this bug. Marking low priority because it has a workaround, but it certainly looks to me like a real bug.

Changed in mysql-5.1 (Ubuntu):
importance: Undecided → Low
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in mysql-5.1 (Ubuntu):
status: New → Confirmed
Revision history for this message
Gabriel Ramirez (gabriel1109) wrote :

Still present in Xenial / mysql-5.7

affects: mysql-5.1 (Ubuntu) → mysql-5.7 (Ubuntu)
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

This still affects Bionic, but it also still is of super low importance.
As even if we would change the default path it would look for, by default slow queries are not enabled.
They have to be enabled in /etc/mysql/mysql.conf.d/mysqld.cnf first, otherwise we will just get the same error, but with a different path.

Also it is no hardcoded path, it is just falling back to "my_print_defaults mysqld" and derives it from --datadir (unless specified).

So what could be changed, I don#t think we want to change that.
So after all the time nothing happened by prio-super-low lets be honest it is fine as it is.

If anything I would wonder that IF slowlog is enabled then I'd expect the code to find e.g.
  --slow_query_log_file=/var/log/mysql/mysql-slow.log
But it does not.

So if one wants to debug the perl and check why with an enabled slow log it does not auto-use the path it finds in there - that is the bug that could be looked at.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Actually it is easy:
- my $slowlog = ($defaults =~ m/--slow-query-log-file=(.*)/)[0];
+ my $slowlog = ($defaults =~ m/--slow_query_log_file=(.*)/)[0];

That is it.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Perl file with .sh ending - /me shivers

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

With the above and slow log enabled in the config it will automatically work like this:

root@b:/etc/mysql# mysqldumpslow

Reading mysql slow query log from /var/log/mysql/mysql-slow.log
Count: 1 Time=0.00s (0s) Lock=0.00s (0s) Rows=0.0 (0), 0users@0hosts

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

FYI - submitted upstream via https://github.com/mysql/mysql-server/pull/213
We will pick it up once merged and released in a new version - prio is too low to consider any SRU IMHO.

Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote (last edit ):

This still affects mysql in jammy.

The fix is still the same submitted by Christian in https://github.com/mysql/mysql-server/pull/213 (which should now be applied to https://github.com/mysql/mysql-server/blob/8.0/scripts/mysqldumpslow.pl.in)

affects: mysql-5.7 (Ubuntu) → mysql-8.0 (Ubuntu)
tags: added: bitesize
Revision history for this message
Lena Voytek (lvoytek) wrote :

I'll add this fix to my next update with a few other bug fixes in kinetic.

Changed in mysql-8.0 (Ubuntu):
status: Confirmed → In Progress
assignee: nobody → Lena Voytek (lvoytek)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.