1MK-ERROR-LOG(1) User Contributed Perl Documentation MK-ERROR-LOG(1)
2
3
4
6 mk-error-log - Find new and different MySQL error log entries.
7
9 Analyze and report on an error log:
10
11 mk-error-log error.log
12
14 The following section is included to inform users about the potential
15 risks, whether known or unknown, of using this tool. The two main
16 categories of risks are those created by the nature of the tool (e.g.
17 read-only tools vs. read-write tools) and those created by bugs.
18
19 mk-error-log merely reads files given on the command line, and should
20 be very low-risk.
21
22 At the time of this release, we know of no bugs that could cause
23 serious harm to users.
24
25 The authoritative source for updated information is always the online
26 issue tracking system. Issues that affect this tool will be marked as
27 such. You can see a list of such issues at the following URL:
28 http://www.maatkit.org/bugs/mk-error-log
29 <http://www.maatkit.org/bugs/mk-error-log>.
30
31 See also "BUGS" for more information on filing bugs and getting help.
32
34 mk-error-log parses MySQL error logs, finding new and different
35 entries, and reports on the frequency and severity of each common
36 entry. Regex patterns are used to detect and group common entries.
37 These patterns are auto-created by mk-error-log when an entry does not
38 match any known patterns. mk-error-log has a built-in list of known
39 patterns; see "--[no]known-patterns". You can also supply your own
40 patterns with the "--load-patterns" option.
41
43 The output is a simple tabular list of error log entires:
44
45 Count Level Message
46 ===== ======= ==================================================
47 5 info mysqld started
48 4 info mysqld version info
49 3 info InnoDB: Started
50 2 info mysqld ended
51 1 unknown Number of processes running now: 0
52 1 error [ERROR] /usr/sbin/mysqld: unknown variable 'ssl-ke
53 1 error [ERROR] Failed to initialize the master info struc
54
55 The log entries (Message) are usually truncated; the full entrie is not
56 always shown.
57
59 --ask-pass
60 Prompt for a password when connecting to MySQL.
61
62 --charset
63 short form: -A; type: string
64
65 Default character set. If the value is utf8, sets Perl's binmode
66 on STDOUT to utf8, passes the mysql_enable_utf8 option to
67 DBD::mysql, and runs SET NAMES UTF8 after connecting to MySQL. Any
68 other value sets binmode on STDOUT without the utf8 layer, and runs
69 SET NAMES after connecting to MySQL.
70
71 --config
72 type: Array
73
74 Read this comma-separated list of config files; if specified, this
75 must be the first option on the command line.
76
77 --[no]continue-on-error
78 default: yes
79
80 Continue parsing even if there is an error.
81
82 --defaults-file
83 short form: -F; type: string
84
85 Only read mysql options from the given file. You must give an
86 absolute pathname.
87
88 --help
89 Show help and exit.
90
91 --host
92 short form: -h; type: string
93
94 Connect to host.
95
96 --[no]known-patterns
97 default: yes
98
99 Load known, built-in patterns.
100
101 mk-error-log has a built-in list of known patterns. This are
102 normally loaded by default, but if you don't want them to be used
103 you can disable them from being loaded by specifying
104 "--no-known-patterns".
105
106 --load-patterns
107 type: string
108
109 Load a list of known patterns from this file.
110
111 Patterns in the file should be formatted like this:
112
113 name1
114 level1
115 pattern1
116
117 nameN
118 levelN
119 patternN
120
121 Each pattern has three parts: name, level and regex pattern.
122 Patterns are separated by a blank line. A pattern's name is what
123 is printed under the Message column in the "OUTPUT". Likewise, its
124 level is printed under the Level column. The regex pattern is what
125 mk-error-log uses to match this pattern. Any Perl regular
126 expression should be valid.
127
128 Here is a simple example:
129
130 InnoDB: The first specified data file did not exist!
131 info
132 InnoDB: The first specified data file \S+
133
134 InnoDB: Rolling back of trx complete
135 info
136 InnoDB: Rolling back of trx id .*?complete
137
138 See also "--save-patterns".
139
140 --password
141 short form: -p; type: string
142
143 Password to use when connecting.
144
145 --pid
146 type: string
147
148 Create the given PID file when daemonized. The file contains the
149 process ID of the daemonized instance. The PID file is removed
150 when the daemonized instance exits. The program checks for the
151 existence of the PID file when starting; if it exists and the
152 process with the matching PID exists, the program exits.
153
154 --port
155 short form: -P; type: int
156
157 Port number to use for connection.
158
159 --resume
160 type: string
161
162 Read and write resume position to this file; resume parsing from
163 last position.
164
165 By default mk-error-log parses an error logs from start (pos 0) to
166 finish. This option allows the tool to start parsing an error log
167 from where it last ended as long as the file has the same name and
168 inode (e.g. it hasn't been rotated) and its size is larger. If the
169 log file's name or inode is different, then a new resume file is
170 started and the old resume file is saved with the old error log's
171 inode appended to its file name. If the log file's size is smaller
172 (e.g. the log was truncated), then parsing begins from the start.
173
174 A resume file is a simple, four line text file like:
175
176 file:/path/to/err.log
177 inode:12345
178 pos:67890
179 size:987100
180
181 The resume file is read at startup and updated when mk-error-log
182 finishes parsing the log. Note that CTRL-C prevents the resume
183 file from being updated.
184
185 If the resume file doesn't exist it is created.
186
187 A line is printed before the main report which tells when and at
188 what position parsing began for the error log if it was resumed.
189
190 --save-patterns
191 type: string
192
193 After running save all new and old patterns to this file.
194
195 This option causes mk-error-log to save every pattern it has to the
196 file. This file can be used for subsequent runs with
197 "--load-patterns". The patterns are saved in descending order of
198 frequency, so the most frequent patterns are at top.
199
200 --set-vars
201 type: string; default: wait_timeout=10000
202
203 Set these MySQL variables. Immediately after connecting to MySQL,
204 this string will be appended to SET and executed.
205
206 --since
207 type: string
208
209 Parse only events newer than this value (parse events since this
210 date).
211
212 This option allows you to ignore events older than a certain value
213 and parse only those events which are more recent than the value.
214 The value can be several types:
215
216 * Simple time value N with optional suffix: N[shmd], where
217 s=seconds, h=hours, m=minutes, d=days (default s if no suffix
218 given); this is like saying "since N[shmd] ago"
219 * Full date with optional hours:minutes:seconds: YYYY-MM-DD [HH:MM::SS]
220 * Short, MySQL-style date: YYMMDD [HH:MM:SS]
221
222 Events are assumed to be in chronological--older events at the
223 beginning of the log and newer events at the end of the log.
224 "--since" is strict: it ignores all events until one is found that
225 is new enough. Therefore, if the events are not consistently
226 timestamped, some may be ignored which are actually new enough.
227
228 See also "--until".
229
230 --socket
231 short form: -S; type: string
232
233 Socket file to use for connection.
234
235 --until
236 type: string
237
238 Parse only events older than this value (parse events until this
239 date).
240
241 This option allows you to ignore events newer than a certain value
242 and parse only those events which are older than the value. The
243 value can be one of the same types listed for "--since".
244
245 Unlike "--since", "--until" is not strict: all events are parsed
246 until one has a timestamp that is equal to or greater than
247 "--until". Then all subsequent events are ignored.
248
249 --user
250 short form: -u; type: string
251
252 User for login if not current user.
253
254 --version
255 Show version and exit.
256
258 You can download Maatkit from Google Code at
259 <http://code.google.com/p/maatkit/>, or you can get any of the tools
260 easily with a command like the following:
261
262 wget http://www.maatkit.org/get/toolname
263 or
264 wget http://www.maatkit.org/trunk/toolname
265
266 Where "toolname" can be replaced with the name (or fragment of a name)
267 of any of the Maatkit tools. Once downloaded, they're ready to run; no
268 installation is needed. The first URL gets the latest released version
269 of the tool, and the second gets the latest trunk code from Subversion.
270
272 The environment variable "MKDEBUG" enables verbose debugging output in
273 all of the Maatkit tools:
274
275 MKDEBUG=1 mk-....
276
278 You need the following Perl modules: DBI and DBD::mysql.
279
281 For list of known bugs see http://www.maatkit.org/bugs/mk-error-log
282 <http://www.maatkit.org/bugs/mk-error-log>.
283
284 Please use Google Code Issues and Groups to report bugs or request
285 support: <http://code.google.com/p/maatkit/>. You can also join
286 #maatkit on Freenode to discuss Maatkit.
287
288 Please include the complete command-line used to reproduce the problem
289 you are seeing, the version of all MySQL servers involved, the complete
290 output of the tool when run with "--version", and if possible,
291 debugging output produced by running with the "MKDEBUG=1" environment
292 variable.
293
295 This program is copyright 2009-2010 Percona Inc. Feedback and
296 improvements are welcome.
297
298 THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
299 WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
300 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
301
302 This program is free software; you can redistribute it and/or modify it
303 under the terms of the GNU General Public License as published by the
304 Free Software Foundation, version 2; OR the Perl Artistic License. On
305 UNIX and similar systems, you can issue `man perlgpl' or `man
306 perlartistic' to read these licenses.
307
308 You should have received a copy of the GNU General Public License along
309 with this program; if not, write to the Free Software Foundation, Inc.,
310 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
311
313 Daniel Nichter
314
316 This tool is part of Maatkit, a toolkit for power users of MySQL.
317 Maatkit was created by Baron Schwartz; Baron and Daniel Nichter are the
318 primary code contributors. Both are employed by Percona. Financial
319 support for Maatkit development is primarily provided by Percona and
320 its clients.
321
323 This manual page documents Ver 1.0.3 Distrib 6839 $Revision: 6831 $.
324
325
326
327perl v5.12.1 2010-08-01 MK-ERROR-LOG(1)