mk-error-log.1p

Langue: en

Autres versions - même langue

Version: 2010-08-01 (fedora - 01/12/10)

Section: 1 (Commandes utilisateur)

NAME

mk-error-log - Find new and different MySQL error log entries.

SYNOPSIS

Analyze and report on an error log:
   mk-error-log error.log
 
 

RISKS

The following section is included to inform users about the potential risks, whether known or unknown, of using this tool. The two main categories of risks are those created by the nature of the tool (e.g. read-only tools vs. read-write tools) and those created by bugs.

mk-error-log merely reads files given on the command line, and should be very low-risk.

At the time of this release, we know of no bugs that could cause serious harm to users.

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 <http://www.maatkit.org/bugs/mk-error-log>.

See also ``BUGS'' for more information on filing bugs and getting help.

DESCRIPTION

mk-error-log parses MySQL error logs, finding new and different entries, and reports on the frequency and severity of each common entry. 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. 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.

OUTPUT

The output is a simple tabular list of error log entires:
   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 entrie is not always shown.

OPTIONS

--ask-pass
Prompt for a password when connecting to MySQL.
--charset
short form: -A; type: string

Default character set. If the value is utf8, sets Perl's binmode on STDOUT to utf8, passes the mysql_enable_utf8 option to DBD::mysql, and runs SET NAMES UTF8 after connecting to MySQL. Any other value sets binmode on STDOUT without the utf8 layer, and runs SET NAMES after connecting to MySQL.

--config
type: Array

Read this comma-separated list of config files; if specified, this must be the first option on the command line.

--[no]continue-on-error
default: yes

Continue parsing even if there is an error.

--defaults-file
short form: -F; type: string

Only read mysql options from the given file. You must give an absolute pathname.

--help
Show help and exit.
--host
short form: -h; type: string

Connect to host.

--[no]known-patterns
default: yes

Load known, built-in patterns.

mk-error-log has a built-in list of known patterns. This 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".

--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.

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.

--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 default mk-error-log parses 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.

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.

--save-patterns
type: string

After running save all new and old patterns to this file.

This option causes mk-error-log to 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.

--set-vars
type: string; default: wait_timeout=10000

Set these MySQL variables. Immediately after connecting to MySQL, this string will be appended to SET and 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 N with optional suffix: N[shmd], where
     s=seconds, h=hours, m=minutes, d=days (default s if no suffix
     given); this is like saying "since N[shmd] ago"
   * Full date with optional hours:minutes:seconds: YYYY-MM-DD [HH:MM::SS]
   * Short, MySQL-style date: YYMMDD [HH:MM:SS]
 
 

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.

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'', ``--until'' is 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.

--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.

ENVIRONMENT

The environment variable "MKDEBUG" enables verbose debugging output in all of the Maatkit tools:
    MKDEBUG=1 mk-....
 
 

SYSTEM REQUIREMENTS

You need the following Perl modules: DBI and DBD::mysql.

BUGS

For list of known bugs see http://www.maatkit.org/bugs/mk-error-log <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.

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.

COPYRIGHT, LICENSE AND WARRANTY

This program is copyright 2009-2010 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 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

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

ABOUT MAATKIT

This tool is part of Maatkit, a toolkit for power users of MySQL. Maatkit was created by Baron Schwartz; Baron and Daniel Nichter are the primary code contributors. Both are employed by Percona. Financial support for Maatkit development is primarily provided by Percona and its clients.

VERSION

This manual page documents Ver 1.0.3 Distrib 6839 $Revision: 6831 $.