MK-ERROR-LOG(1)
π mk-error-log(1) β the perl tool era π
okay bestie, so this is mk-error-log, a User Contributed Perl Documentation page, and it is literally here to find new and different MySQL error log entries. she reads, she groups, she reports. no cap.
β¨ NAME β¨
mk-error-log β find new and different MySQL error log entries. that's the whole job. she's a detective π΅οΈββοΈ
πΈ SYNOPSIS πΈ
Usage: mk-error-log [OPTION...] FILE [FILE...]
mk-error-log parses and aggregates MySQL error log statements. she takes those messy little log lines and makes them make sense.
analyze and report on an error log:
mk-error-log /var/log/mysql/mysqld.err
yes bestie, that's it. point her at a file and she goes to work π
π RISKS π
so this section exists to be honest with you about the potential risks β whether known or unknown β of using this tool. there are two main categories, okay: risks that come from the nature of the tool (like, read-only tools vs. read-write tools, huge difference), and risks that come from bugs.
mk-error-log merely reads files given on the command line, and should be very low-risk. she's a reader not a writer, she's not out here changing anything. she just looks. π
at the time of this release, we know of no bugs that could cause serious harm to users. slay.
the authoritative source for updated information is always the online issue tracking system. issues that affect this tool will be marked as such. you can see a list of such issues at the following URL:
<http://www.maatkit.org/bugs/mk-error-log>
see also "BUGS" for more information on filing bugs and getting help. don't skip that part bestie π«Ά
π¦ DESCRIPTION π¦
mk-error-log parses MySQL error logs, finding new and different entries, and reports on the frequency and severity of each common entry. like a vibe check but for your error log.
regex patterns are used to detect and group common entries. these patterns are auto-created by mk-error-log when an entry does not match any known patterns. so she's not just reading, she's learning β main character energy honestly.
mk-error-log has a built-in list of known patterns; see --[no]known-patterns. you can also supply your own patterns with the --load-patterns option. your patterns, her power. πͺ
π OUTPUT π
the output is a simple tabular list of error log entries:
Count Level Message
===== ======= ==================================================
5 info mysqld started
4 info mysqld version info
3 info InnoDB: Started
2 info mysqld ended
1 unknown Number of processes running now: 0
1 error [ERROR] /usr/sbin/mysqld: unknown variable 'ssl-ke
1 error [ERROR] Failed to initialize the master info struc
the log entries (Message) are usually truncated; the full entry is not always shown. so don't panic when a line just cuts off mid-word, that's just how she prints it. it's giving "i ran out of room" π
β¨ OPTIONS β¨
this tool accepts additional command-line arguments. refer to the "SYNOPSIS" and usage information for details. okay now let's go through every single one, no skipping:
--ask-passβ prompt for a password when connecting to MySQL. she'll ask, you provide. secure girl behavior π--charsetβ short form:-A; type: string. default character set. if the value isutf8, sets Perl's binmode onSTDOUTto utf8, passes themysql_enable_utf8option toDBD::mysql, and runsSET NAMES UTF8after connecting to MySQL. any other value sets binmode onSTDOUTwithout the utf8 layer, and runsSET NAMESafter connecting to MySQL. soutf8is the special one, got it? β¨--configβ type: Array. read this comma-separated list of config files; if specified, this must be the first option on the command line. first means FIRST bestie, don't test her.--[no]continue-on-errorβ default:yes. continue parsing even if there is an error. she's resilient like that πͺ--defaults-fileβ short form:-F; type: string. only read mysql options from the given file. you must give an absolute pathname. no relative paths, she said what she said.--helpβ show help and exit. the classic. π--hostβ short form:-h; type: string. connect to host.--[no]known-patternsβ default:yes. load known, built-in patterns.mk-error-loghas a built-in list of known patterns. these are normally loaded by default, but if you don't want them to be used you can disable them from being loaded by specifying--no-known-patterns. your call, your rules π--load-patternsβ type: string. load a list of known patterns from this file. patterns in the file should be formatted like this:
name1
level1
pattern1
nameN
levelN
patternN
each pattern has three parts: name, level and regex pattern. patterns are separated by a blank line. a pattern's name is what is printed under the Message column in the "OUTPUT". likewise, its level is printed under the Level column. the regex pattern is what mk-error-log uses to match this pattern. any Perl regular expression should be valid. so go off, write your own, she'll read them π
here is a simple example:
InnoDB: The first specified data file did not exist!
info
InnoDB: The first specified data file \S+
InnoDB: Rolling back of trx complete
info
InnoDB: Rolling back of trx id .*?complete
see also --save-patterns. π
--passwordβ short form:-p; type: string. password to use when connecting.--pidβ type: string. create the given PID file when daemonized. the file contains the process ID of the daemonized instance. the PID file is removed when the daemonized instance exits. the program checks for the existence of the PID file when starting; if it exists and the process with the matching PID exists, the program exits. so if she's already running, she's not running twice. boundaries. π«--portβ short form:-P; type: int. port number to use for connection.--resumeβ type: string. read and write resume position to this file; resume parsing from last position. by defaultmk-error-logparses an error logs from start (pos 0) to finish. this option allows the tool to start parsing an error log from where it last ended as long as the file has the same name and inode (e.g. it hasn't been rotated) and its size is larger. if the log file's name or inode is different, then a new resume file is started and the old resume file is saved with the old error log's inode appended to its file name. if the log file's size is smaller (e.g. the log was truncated), then parsing begins from the start. a resume file is a simple, four line text file like:
file:/path/to/err.log
inode:12345
pos:67890
size:987100
the resume file is read at startup and updated when mk-error-log finishes parsing the log. note that CTRL-C prevents the resume file from being updated. so don't slam ctrl-c and then be surprised, okay? π
if the resume file doesn't exist it is created.
a line is printed before the main report which tells when and at what position parsing began for the error log if it was resumed. so you always know where she picked up π
--save-patternsβ type: string. after running save all new and old patterns to this file. this option causesmk-error-logto save every pattern it has to the file. this file can be used for subsequent runs with--load-patterns. the patterns are saved in descending order of frequency, so the most frequent patterns are at top. most frequent gets top billing, icon behavior β--set-varsβ type: string; default:wait_timeout=10000. set these MySQL variables. immediately after connecting to MySQL, this string will be appended toSETand executed.--sinceβ type: string. parse only events newer than this value (parse events since this date). this option allows you to ignore events older than a certain value and parse only those events which are more recent than the value. the value can be several types:- simple time value
Nwith optional suffix:N[shmd], wheres=seconds,h=hours,m=minutes,d=days (defaultsif no suffix given); this is like saying "sinceN[shmd]ago" - full date with optional hours:minutes:seconds:
YYYY-MM-DD [HH:MM::SS] - short, MySQL-style date:
YYMMDD [HH:MM:SS]
- simple time value
events are assumed to be in chronological--older events at the beginning of the log and newer events at the end of the log. --since is strict: it ignores all events until one is found that is new enough. therefore, if the events are not consistently timestamped, some may be ignored which are actually new enough. so like, she's strict and sometimes that means she's a little too strict. that's the tradeoff bestie π€·ββοΈ
see also --until.
--socketβ short form:-S; type: string. socket file to use for connection.--untilβ type: string. parse only events older than this value (parse events until this date). this option allows you to ignore events newer than a certain value and parse only those events which are older than the value. the value can be one of the same types listed for--since. unlike--since,--untilis not strict: all events are parsed until one has a timestamp that is equal to or greater than--until. then all subsequent events are ignored. so she's strict on the front end and chill on the back end. balance β¨--userβ short form:-u; type: string. user for login if not current user.--versionβ show version and exit. π·οΈ
π DOWNLOADING π
you can download Maatkit from Google Code at:
<http://code.google.com/p/maatkit/>
or you can get any of the tools easily with a command like the following:
wget http://www.maatkit.org/get/toolname
or
wget http://www.maatkit.org/trunk/toolname
where toolname can be replaced with the name (or fragment of a name) of any of the Maatkit tools. once downloaded, they're ready to run; no installation is needed. the first URL gets the latest released version of the tool, and the second gets the latest trunk code from Subversion. no build step, no drama, just download and go π¦
π§ ENVIRONMENT π§
the environment variable MKDEBUG enables verbose debugging output in all of the Maatkit tools:
MKDEBUG=1 mk-....
yes, mk-.... β that's the actual thing in the docs, it's a placeholder, don't come for me π
β SYSTEM REQUIREMENTS β
you need the following Perl modules: DBI and DBD::mysql. that's the whole list. get those and you're set π₯
π BUGS π
for a list of known bugs see:
<http://www.maatkit.org/bugs/mk-error-log>
please use Google Code Issues and Groups to report bugs or request support:
<http://code.google.com/p/maatkit/>
you can also join #maatkit on Freenode to discuss Maatkit. come hang out, the vibes are immaculate π«Ά
please include the complete command-line used to reproduce the problem you are seeing, the version of all MySQL servers involved, the complete output of the tool when run with --version, and if possible, debugging output produced by running with the MKDEBUG=1 environment variable. seriously, include all of it. the more info the better, that's how bugs get fixed bestie π
π COPYRIGHT, LICENSE AND WARRANTY π
this program is copyright 2009-2011 Percona Inc. feedback and improvements are welcome. π
THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
okay that part is in all caps in the original and it stays that way, because it matters. no warranty, fr fr. π
this program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2; OR the Perl Artistic License. on UNIX and similar systems, you can issue man perlgpl or man perlartistic to read these licenses.
you should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
π AUTHOR π
Daniel Nichter
okay and that's part 1 bestie β more is coming, don't go anywhere π
β¨ ABOUT MAATKIT β¨
okay so real talk, this whole thing is part of Maatkit, which is a toolkit made for power users of MySQL. like, the people who live in their terminal and have opinions about query plans. iykyk π
Maatkit was created by Baron Schwartz, and Baron and Daniel Nichter are the primary code contributors. both of them are employed by Percona. π«Ά
and the financial support for Maatkit development? primarily provided by Percona and its clients. so yeah, thank you besties, we love a sponsor that funds open source π
πΈ VERSION πΈ
This manual page documents Ver 1.0.3 Distrib 7540 $Revision: 7477 $.
no cap, that's the version. screenshot it, cite it, whatever, just don't come for me if you're on something older π
aaaand that's the whole page bestie, you made it to the end, main character energy fr fr π
cute little sign-off for the record: this page came from perl v5.42.0, dated 2025-07-24, and it's filed under MK-ERROR-LOG(1). go forth and read your error logs, icon π
β¨π¦
π¦ where this page comes from
- fedora 43: maatkit 7540-39.fc43 Β· GPL-2.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms