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.
6
6
All query log system variables are global and dynamic so they can be changed while Drizzle is running.
13
To load this plugin, start :program:`drizzled` with::
15
--plugin-add=query_log
17
Loading the plugin may not enable or configure it. See the plugin's
18
:ref:`query_log_configuration` and :ref:`query_log_variables`.
20
.. seealso:: :doc:`/options` for more information about adding and removing plugins.
22
.. _query_log_configuration:
13
29
.. option:: --query-log.file FILE
15
| Default: :file:`drizzled-queries.log`
16
| Variable: ``query_log_file``
31
:Default: :file:`drizzled-queries.log`
32
:Variable: ``query_log_file``
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`
52
68
.. option:: --query-log.threshold-rows-examined N
55
| Variable: ``query_log_threshold_rows_examined``
71
:Variable: ``query_log_threshold_rows_examined``
57
73
Log queries that examine more than ``N`` rows.
59
75
.. option:: --query-log.threshold-rows-sent N
62
| Variable: ``query_log_threshold_rows_sent``
78
:Variable: ``query_log_threshold_rows_sent``
64
80
Log queries that send (return) more than ``N`` rows.
66
82
.. option:: --query-log.threshold-session-time MICROSECONDS
69
| Variable: ``query_log_threshold_session_time``
85
:Variable: ``query_log_threshold_session_time``
71
87
Log queries form sessions active longer than ``MICROSECONDS``.
72
88
The query log file writes ``session_time`` as seconds with six decimal
76
92
.. option:: --query-log.threshold-tmp-tables N
79
| Variable: ``query_log_threshold_tmp_tables``
95
:Variable: ``query_log_threshold_tmp_tables``
81
97
Log queries that use more than ``N`` temporary tables.
83
99
.. option:: --query-log.threshold-warnings N
86
| Variable: ``query_log_threshold_warnings``
102
:Variable: ``query_log_threshold_warnings``
88
104
Log queries that cause more than ``N`` errors.
106
.. _query_log_variables:
111
These variables show the running configuration of the plugin.
112
See `variables` for more information about querying and setting variables.
114
.. _query_log_enabled:
116
* ``query_log_enabled``
122
If query logging is globally enabled or not.
130
:Option: :option:`--query-log.file`
134
.. _query_log_file_enabled:
136
* ``query_log_file_enabled``
140
:Option: :option:`--query-log.file-enabled`
142
If query logging to a file is enabled.
144
.. _query_log_threshold_execution_time:
146
* ``query_log_threshold_execution_time``
150
:Option: :option:`--query-log.threshold-execution-time`
152
Threshold for logging slow queries.
154
.. _query_log_threshold_lock_time:
156
* ``query_log_threshold_lock_time``
160
:Option: :option:`--query-log.threshold-lock-time`
162
Threshold for logging long locking queries.
164
.. _query_log_threshold_rows_examined:
166
* ``query_log_threshold_rows_examined``
170
:Option: :option:`--query-log.threshold-rows-examined`
172
Threshold for logging queries that examine too many rows.
174
.. _query_log_threshold_rows_sent:
176
* ``query_log_threshold_rows_sent``
180
:Option: :option:`--query-log.threshold-rows-sent`
182
Threshold for logging queries that return too many rows.
184
.. _query_log_threshold_session_time:
186
* ``query_log_threshold_session_time``
190
:Option: :option:`--query-log.threshold-session-time`
192
Threshold for logging queries that are active too long.
194
.. _query_log_threshold_tmp_tables:
196
* ``query_log_threshold_tmp_tables``
200
:Option: :option:`--query-log.threshold-tmp-tables`
202
Threshold for logging queries that use too many temporary tables.
204
.. _query_log_threshold_warnings:
206
* ``query_log_threshold_warnings``
210
:Option: :option:`--query-log.threshold-warnings`
212
Threshold for logging queries that cause too many warnings.
179
303
0.5 second * 1000000 = 500000 microseconds
181
305
To convert back, multiple the number of microseconds by ``0.000001`` (that's zero point five zeros and a one).
307
.. _query_log_authors:
314
.. _query_log_version:
319
This documentation applies to **query_log 0.1**.
321
To see which version of the plugin a Drizzle server is running, execute:
323
.. code-block:: mysql
325
SELECT MODULE_VERSION FROM DATA_DICTIONARY.MODULES WHERE MODULE_NAME='query_log'