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