~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/query_log/docs/index.rst

  • Committer: Daniel
  • Date: 2011-09-18 20:03:12 UTC
  • mto: This revision was merged to the branch mainline in revision 2422.
  • Revision ID: daniel@ubuntu-10-20110918200312-wuih58m2iey3l5t5
Make first event line start_ts=TS.  Update and expand docu; fix a typo (wrong version).

Show diffs side-by-side

added added

removed removed

Lines of Context:
116
116
* ``query_log_enabled``
117
117
 
118
118
   :Scope: Global
119
 
   :Dynamic: No
 
119
   :Dynamic: Yes
120
120
   :Option:
121
121
 
122
122
   If query logging is globally enabled or not.
126
126
* ``query_log_file``
127
127
 
128
128
   :Scope: Global
129
 
   :Dynamic: No
 
129
   :Dynamic: Yes
130
130
   :Option: :option:`--query-log.file`
131
131
 
132
132
   Query log file.
136
136
* ``query_log_file_enabled``
137
137
 
138
138
   :Scope: Global
139
 
   :Dynamic: No
 
139
   :Dynamic: Yes
140
140
   :Option: :option:`--query-log.file-enabled`
141
141
 
142
142
   If query logging to a file is enabled.
146
146
* ``query_log_threshold_execution_time``
147
147
 
148
148
   :Scope: Global
149
 
   :Dynamic: No
 
149
   :Dynamic: Yes
150
150
   :Option: :option:`--query-log.threshold-execution-time`
151
151
 
152
152
   Threshold for logging slow queries.
156
156
* ``query_log_threshold_lock_time``
157
157
 
158
158
   :Scope: Global
159
 
   :Dynamic: No
 
159
   :Dynamic: Yes
160
160
   :Option: :option:`--query-log.threshold-lock-time`
161
161
 
162
162
   Threshold for logging long locking queries.
166
166
* ``query_log_threshold_rows_examined``
167
167
 
168
168
   :Scope: Global
169
 
   :Dynamic: No
 
169
   :Dynamic: Yes
170
170
   :Option: :option:`--query-log.threshold-rows-examined`
171
171
 
172
172
   Threshold for logging queries that examine too many rows.
176
176
* ``query_log_threshold_rows_sent``
177
177
 
178
178
   :Scope: Global
179
 
   :Dynamic: No
 
179
   :Dynamic: Yes
180
180
   :Option: :option:`--query-log.threshold-rows-sent`
181
181
 
182
182
   Threshold for logging queries that return too many rows.
186
186
* ``query_log_threshold_session_time``
187
187
 
188
188
   :Scope: Global
189
 
   :Dynamic: No
 
189
   :Dynamic: Yes
190
190
   :Option: :option:`--query-log.threshold-session-time`
191
191
 
192
192
   Threshold for logging queries that are active too long.
196
196
* ``query_log_threshold_tmp_tables``
197
197
 
198
198
   :Scope: Global
199
 
   :Dynamic: No
 
199
   :Dynamic: Yes
200
200
   :Option: :option:`--query-log.threshold-tmp-tables`
201
201
 
202
202
   Threshold for logging queries that use too many temporary tables.
206
206
* ``query_log_threshold_warnings``
207
207
 
208
208
   :Scope: Global
209
 
   :Dynamic: No
 
209
   :Dynamic: Yes
210
210
   :Option: :option:`--query-log.threshold-warnings`
211
211
 
212
212
   Threshold for logging queries that cause too many warnings.
214
214
Examples
215
215
--------
216
216
 
217
 
Start Drizzle with the query plugin and log queries that take longer than 1 second to execute to the default log file:
 
217
Start Drizzle with the query plugin and log queries that take longer than 1 second to execute to the default query log file:
218
218
 
219
219
.. code-block:: none
220
220
 
257
257
Log File
258
258
^^^^^^^^
259
259
 
260
 
The log file destination is enabled when both ``query_log_enabled`` and ``query_log_file_enabled`` are true (``SHOW VARIABLES`` lists ``ON`` and ``OFF`` instead of ``TRUE`` and ``FASLE``).  When ``query_log_file_enabled`` is true, the ``query_log_file`` is open.  When ``query_log_file_enabled`` is set false, the log file is closed.  This is helpful if you want to rotate the log file.
 
260
The query log file destination is enabled when both ``query_log_enabled`` and ``query_log_file_enabled`` are true (``SHOW VARIABLES`` lists ``ON`` and ``OFF`` instead of ``TRUE`` and ``FASLE``).  When ``query_log_file_enabled`` is true, the ``query_log_file`` is open.  When ``query_log_file_enabled`` is set false, the query log file is closed.  This is helpful if you want to rotate the query log file.
261
261
 
262
 
The log file is a plain text, structured file that is readable by humans and easily parsable by tools.  It looks like:
 
262
The query log file is a plain text, structured file that is readable by humans and easily parsable by tools.  It looks like:
263
263
 
264
264
.. code-block:: none
265
265
 
266
 
  # 2011-05-15T01:48:17.814985
 
266
  # start_ts=2011-05-15T01:48:17.814985
267
267
  # session_id=1 query_id=6 rows_examined=0 rows_sent=0 tmp_tables=0 warnings=1
268
268
  # execution_time=0.000315 lock_time=0.000315 session_time=16.723020
269
269
  # error=true
270
270
  # schema=""
271
271
  set query_log_file_enabled=true;
272
272
  #
273
 
  # 2011-05-15T01:48:21.526746
 
273
  # start_ts=2011-05-15T01:48:21.526746
274
274
  # session_id=1 query_id=7 rows_examined=10 rows_sent=10 tmp_tables=0 warnings=0
275
275
  # execution_time=0.000979 lock_time=0.000562 session_time=20.435445
276
276
  # error=false
280
280
 
281
281
Events are separated by a single ``#`` character.  This record separator can be used by programs like :program:`awk` and :program:`perl` to easily separate events in a log.
282
282
 
283
 
The first line line of each event is a UTC/GMT timestamp with microsecond precision; the timezone cannot be changed.  The second line has attributes with integer values.  The third line has attributes with high-precision time values, always with six decimals places of precision.  The fourth line has attributes with boolean values, either ``true`` or ``false``.  The fifth line has attributes with string values, always double-quoted.  Remaining lines are the query which can contain multiple lines, blank lines, et.  The record separator marks the event of the event.
 
283
The first line of each event has UTC/GMT timestamps with microsecond precision; the timezone cannot be changed.  The second line has attributes with integer values.  The third line has attributes with high-precision time values, always with six decimals places of precision.  The fourth line has attributes with boolean values, either ``true`` or ``false``.  The fifth line has attributes with string values, always double-quoted.  Remaining lines are the query which can contain multiple lines, blank lines, et.  The record separator marks the event of the event.
 
284
 
 
285
As the example above demonstrates, the meta-format for each event in the query log is::
 
286
 
 
287
  # attribute=value
 
288
  query
 
289
  #
 
290
 
 
291
Parsing a query log file should be easy since the format is static, consistent, and follows
 
292
these rules:
 
293
 
 
294
  * Attribute-value pairs are on comment lines that begin with one ``#`` character followed
 
295
    by a space.
 
296
  * Comment lines have one or more attribute-value pairs.
 
297
  * Attribute-value pairs are separated by one space.
 
298
  * Attribute names are lowercase with only characters ``a`` to ``z`` and ``_`` (underscore).
 
299
  * Attribute names with suffix ``_ts`` have microsecond UTC/GMT timestamp values.
 
300
  * Attribute names with suffix ``_time`` have values with an amount of time in seconds with
 
301
    microsecond precision.
 
302
  * One or more comment line precedes the query.
 
303
  * A query is always printed; there are no "admin commands" or special queries.
 
304
  * Every query is terminated by one ``#`` character followed by a newline (``\n``),
 
305
    even the last query in the log file.
 
306
  * There are no blank lines between events.
 
307
  * Only events with this format are printed; there are no special or "fluff" lines.
284
308
 
285
309
Bugs and Limitations
286
310
--------------------
316
340
Version
317
341
-------
318
342
 
319
 
This documentation applies to **query_log 0.1**.
 
343
This documentation applies to **query_log 1.0**.
320
344
 
321
345
To see which version of the plugin a Drizzle server is running, execute:
322
346
 
327
351
Changelog
328
352
---------
329
353
 
330
 
v0.1
 
354
v1.0
331
355
^^^^
332
356
* First release.