~vjsamuel/drizzle/fix-bug-850858

« back to all changes in this revision

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

  • Committer: Mark Atwood
  • Date: 2011-09-13 19:54:55 UTC
  • mfrom: (2397.1.3 plugin-docs)
  • Revision ID: me@mark.atwood.name-20110913195455-3bk3locm85m4jimp
mergeĀ lp:~daniel-nichter/drizzle/plugin-docs

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
Query Log
2
2
=========
3
3
 
4
 
The Query Log plugin logs queries to :ref:`logging-destinations`.  When :program:`drizzled` is started with  ``--plugin-add=query-log``, the query log plugin is enabled but all logging destinations are disabled to prevent flooding on busy servers because *all* queries are logged by default.  A destination can be enabled on the command line or later with ``SET GLOBAL``, and various thresholds can be set which restrict logging.
 
4
The :program:`query_log` plugin logs queries to :ref:`logging-destinations`.  When :program:`drizzled` is started with  ``--plugin-add=query-log``, the query log plugin is enabled but all logging destinations are disabled to prevent flooding on busy servers because *all* queries are logged by default.  A destination can be enabled on the command line or later with ``SET GLOBAL``, and various thresholds can be set which restrict logging.
5
5
 
6
6
All query log system variables are global and dynamic so they can be changed while Drizzle is running.
7
7
 
 
8
.. _query_log_loading:
 
9
 
 
10
Loading
 
11
-------
 
12
 
 
13
To load this plugin, start :program:`drizzled` with::
 
14
 
 
15
   --plugin-add=query_log
 
16
 
 
17
Loading the plugin may not enable or configure it.  See the plugin's
 
18
:ref:`query_log_configuration` and :ref:`query_log_variables`.
 
19
 
 
20
.. seealso:: :doc:`/options` for more information about adding and removing plugins.
 
21
 
 
22
.. _query_log_configuration:
 
23
 
8
24
Configuration
9
25
-------------
10
26
 
12
28
 
13
29
.. option:: --query-log.file FILE
14
30
 
15
 
  | Default: :file:`drizzled-queries.log`
16
 
  | Variable: ``query_log_file``
 
31
  :Default: :file:`drizzled-queries.log`
 
32
  :Variable: ``query_log_file``
17
33
 
18
34
  The query log file.  The file is created if it does not exist.  If a full
19
35
  path is not specified, the default relative path is the :file:`local`
21
37
 
22
38
.. option:: --query-log.file-enabled
23
39
 
24
 
  | Default: ``FALSE``
25
 
  | Variable: ``query_log_file_enabled``
 
40
  :Default: ``FALSE``
 
41
  :Variable: ``query_log_file_enabled``
26
42
 
27
43
  Enable logging to :option:`--query-log.file`.
28
44
  This logging destination is disabled by default.  Specify this option to
31
47
 
32
48
.. option:: --query-log.threshold-execution-time MICROSECONDS
33
49
 
34
 
  | Default: ``0``
35
 
  | Variable: ``query_log_threshold_execution_time``
 
50
  :Default: ``0``
 
51
  :Variable: ``query_log_threshold_execution_time``
36
52
 
37
53
  Log queries with execution times greater than ``MICROSECONDS``.
38
54
  The query log file writes ``execution_time`` as seconds with six decimal
41
57
 
42
58
.. option:: --query-log.threshold-lock-time MICROSECONDS
43
59
 
44
 
  | Default: ``0``
45
 
  | Variable: ``query_log_threshold_lock_time``
 
60
  :Default: ``0``
 
61
  :Variable: ``query_log_threshold_lock_time``
46
62
 
47
63
  Log queries with lock times greater than ``MICROSECONDS``.
48
64
  The query log file writes ``lock_time`` as seconds with six decimal
51
67
 
52
68
.. option:: --query-log.threshold-rows-examined N
53
69
 
54
 
  | Default: ``0``
55
 
  | Variable: ``query_log_threshold_rows_examined``
 
70
  :Default: ``0``
 
71
  :Variable: ``query_log_threshold_rows_examined``
56
72
 
57
73
  Log queries that examine more than ``N`` rows.
58
74
 
59
75
.. option:: --query-log.threshold-rows-sent N
60
76
 
61
 
  | Default: ``0``
62
 
  | Variable: ``query_log_threshold_rows_sent``
 
77
  :Default: ``0``
 
78
  :Variable: ``query_log_threshold_rows_sent``
63
79
 
64
80
  Log queries that send (return) more than ``N`` rows.
65
81
 
66
82
.. option:: --query-log.threshold-session-time MICROSECONDS
67
83
 
68
 
  | Default: ``0``
69
 
  | Variable: ``query_log_threshold_session_time``
 
84
  :Default: ``0``
 
85
  :Variable: ``query_log_threshold_session_time``
70
86
 
71
87
  Log queries form sessions active longer than ``MICROSECONDS``.
72
88
  The query log file writes ``session_time`` as seconds with six decimal
75
91
 
76
92
.. option:: --query-log.threshold-tmp-tables N
77
93
 
78
 
  | Default: ``0``
79
 
  | Variable: ``query_log_threshold_tmp_tables``
 
94
  :Default: ``0``
 
95
  :Variable: ``query_log_threshold_tmp_tables``
80
96
 
81
97
  Log queries that use more than ``N`` temporary tables.
82
98
 
83
99
.. option:: --query-log.threshold-warnings N
84
100
 
85
 
  | Default: ``0``
86
 
  | Variable: ``query_log_threshold_warnings``
 
101
  :Default: ``0``
 
102
  :Variable: ``query_log_threshold_warnings``
87
103
 
88
104
  Log queries that cause more than ``N`` errors.
89
105
 
 
106
.. _query_log_variables:
 
107
 
 
108
Variables
 
109
---------
 
110
 
 
111
These variables show the running configuration of the plugin.
 
112
See `variables` for more information about querying and setting variables.
 
113
 
 
114
.. _query_log_enabled:
 
115
 
 
116
* ``query_log_enabled``
 
117
 
 
118
   :Scope: Global
 
119
   :Dynamic: No
 
120
   :Option:
 
121
 
 
122
   If query logging is globally enabled or not.
 
123
 
 
124
.. _query_log_file:
 
125
 
 
126
* ``query_log_file``
 
127
 
 
128
   :Scope: Global
 
129
   :Dynamic: No
 
130
   :Option: :option:`--query-log.file`
 
131
 
 
132
   Query log file.
 
133
 
 
134
.. _query_log_file_enabled:
 
135
 
 
136
* ``query_log_file_enabled``
 
137
 
 
138
   :Scope: Global
 
139
   :Dynamic: No
 
140
   :Option: :option:`--query-log.file-enabled`
 
141
 
 
142
   If query logging to a file is enabled.
 
143
 
 
144
.. _query_log_threshold_execution_time:
 
145
 
 
146
* ``query_log_threshold_execution_time``
 
147
 
 
148
   :Scope: Global
 
149
   :Dynamic: No
 
150
   :Option: :option:`--query-log.threshold-execution-time`
 
151
 
 
152
   Threshold for logging slow queries.
 
153
 
 
154
.. _query_log_threshold_lock_time:
 
155
 
 
156
* ``query_log_threshold_lock_time``
 
157
 
 
158
   :Scope: Global
 
159
   :Dynamic: No
 
160
   :Option: :option:`--query-log.threshold-lock-time`
 
161
 
 
162
   Threshold for logging long locking queries.
 
163
 
 
164
.. _query_log_threshold_rows_examined:
 
165
 
 
166
* ``query_log_threshold_rows_examined``
 
167
 
 
168
   :Scope: Global
 
169
   :Dynamic: No
 
170
   :Option: :option:`--query-log.threshold-rows-examined`
 
171
 
 
172
   Threshold for logging queries that examine too many rows.
 
173
 
 
174
.. _query_log_threshold_rows_sent:
 
175
 
 
176
* ``query_log_threshold_rows_sent``
 
177
 
 
178
   :Scope: Global
 
179
   :Dynamic: No
 
180
   :Option: :option:`--query-log.threshold-rows-sent`
 
181
 
 
182
   Threshold for logging queries that return too many rows.
 
183
 
 
184
.. _query_log_threshold_session_time:
 
185
 
 
186
* ``query_log_threshold_session_time``
 
187
 
 
188
   :Scope: Global
 
189
   :Dynamic: No
 
190
   :Option: :option:`--query-log.threshold-session-time`
 
191
 
 
192
   Threshold for logging queries that are active too long.
 
193
 
 
194
.. _query_log_threshold_tmp_tables:
 
195
 
 
196
* ``query_log_threshold_tmp_tables``
 
197
 
 
198
   :Scope: Global
 
199
   :Dynamic: No
 
200
   :Option: :option:`--query-log.threshold-tmp-tables`
 
201
 
 
202
   Threshold for logging queries that use too many temporary tables.
 
203
 
 
204
.. _query_log_threshold_warnings:
 
205
 
 
206
* ``query_log_threshold_warnings``
 
207
 
 
208
   :Scope: Global
 
209
   :Dynamic: No
 
210
   :Option: :option:`--query-log.threshold-warnings`
 
211
 
 
212
   Threshold for logging queries that cause too many warnings.
 
213
 
90
214
Examples
91
215
--------
92
216
 
179
303
  0.5 second *  1000000 = 500000 microseconds
180
304
 
181
305
To convert back, multiple the number of microseconds by ``0.000001`` (that's zero point five zeros and a one).
 
306
 
 
307
.. _query_log_authors:
 
308
 
 
309
Authors
 
310
-------
 
311
 
 
312
Daniel Nichter
 
313
 
 
314
.. _query_log_version:
 
315
 
 
316
Version
 
317
-------
 
318
 
 
319
This documentation applies to **query_log 0.1**.
 
320
 
 
321
To see which version of the plugin a Drizzle server is running, execute:
 
322
 
 
323
.. code-block:: mysql
 
324
 
 
325
   SELECT MODULE_VERSION FROM DATA_DICTIONARY.MODULES WHERE MODULE_NAME='query_log'
 
326
 
 
327
Changelog
 
328
---------
 
329
 
 
330
v0.1
 
331
^^^^
 
332
* First release.