499.2.14
by Mark Atwood
fixes as per MontyT's comments, prep for internationalization |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
499.2.10
by Mark Atwood
add editor format hints, and other useful metadata comments |
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
499.2.14
by Mark Atwood
fixes as per MontyT's comments, prep for internationalization |
3 |
*
|
1010
by Brian Aker
Replacing Sun employee copyright headers (aka... anything done by a Sun |
4 |
* Copyright (C) 2008,2009 Sun Microsystems
|
499.2.10
by Mark Atwood
add editor format hints, and other useful metadata comments |
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License as published by
|
|
8 |
* the Free Software Foundation; version 2 of the License.
|
|
9 |
*
|
|
10 |
* This program is distributed in the hope that it will be useful,
|
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
* GNU General Public License for more details.
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License
|
|
16 |
* along with this program; if not, write to the Free Software
|
|
17 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
18 |
*/
|
|
383.6.1
by Mark Atwood
add pluggable logging |
19 |
|
1241.9.36
by Monty Taylor
ZOMG. I deleted drizzled/server_includes.h. |
20 |
#include "config.h" |
1130.1.1
by Monty Taylor
Merged in plugin-slot-reorg patches. |
21 |
#include <drizzled/plugin/logging.h> |
549
by Monty Taylor
Took gettext.h out of header files. |
22 |
#include <drizzled/gettext.h> |
584.1.15
by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes. |
23 |
#include <drizzled/session.h> |
1076.1.1
by Trond Norbye
Use PCRE_HEADER instead of <pcre.h> |
24 |
#include PCRE_HEADER
|
1259.7.4
by Monty Taylor
Fixed namespace and include issues in some plugins we hadn't been building. |
25 |
#include <limits.h> |
26 |
#include <sys/time.h> |
|
27 |
#include <sys/types.h> |
|
28 |
#include <sys/stat.h> |
|
29 |
#include <fcntl.h> |
|
1607.1.1
by David Shrewsbury
Replace static buffers with std::string. |
30 |
#include <string> |
31 |
#include <boost/format.hpp> |
|
1660.7.1
by Vijay Samuel
Merge re factored commandline for logging_query using boost::program_options |
32 |
#include <boost/program_options.hpp> |
33 |
#include <drizzled/module/option_map.h> |
|
1502.3.1
by iwamatsu at nigauri
Add cstdio include to files needing it. Fixes the build on some debian |
34 |
#include <cstdio> |
1702.3.3
by LinuxJedi
Fix errors in FreeBSD build |
35 |
#include <cerrno> |
1259.7.4
by Monty Taylor
Fixed namespace and include issues in some plugins we hadn't been building. |
36 |
|
1660.7.1
by Vijay Samuel
Merge re factored commandline for logging_query using boost::program_options |
37 |
namespace po= boost::program_options; |
1259.7.4
by Monty Taylor
Fixed namespace and include issues in some plugins we hadn't been building. |
38 |
using namespace drizzled; |
1607.1.1
by David Shrewsbury
Replace static buffers with std::string. |
39 |
using namespace std; |
383.6.1
by Mark Atwood
add pluggable logging |
40 |
|
1607.1.1
by David Shrewsbury
Replace static buffers with std::string. |
41 |
#define ESCAPE_CHAR '\\'
|
42 |
#define SEPARATOR_CHAR ','
|
|
383.6.3
by Mark Atwood
more work on plugable logging |
43 |
|
812.1.6
by Mark Atwood
logging to syslog |
44 |
static bool sysvar_logging_query_enable= false; |
45 |
static char* sysvar_logging_query_filename= NULL; |
|
1039.4.5
by Mark Atwood
add PCRE matching to logging to file |
46 |
static char* sysvar_logging_query_pcre= NULL; |
47 |
/* TODO fix these to not be unsigned long once we have sensible sys_var system */
|
|
779.5.2
by Monty Taylor
Few more style fixes. |
48 |
static unsigned long sysvar_logging_query_threshold_slow= 0; |
49 |
static unsigned long sysvar_logging_query_threshold_big_resultset= 0; |
|
50 |
static unsigned long sysvar_logging_query_threshold_big_examined= 0; |
|
438.2.2
by Mark Atwood
sysvar for filename for pluggable query logging to log to |
51 |
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
52 |
/* stolen from mysys/my_getsystime
|
520.1.21
by Brian Aker
THD -> Session rename |
53 |
until the Session has a good utime "now" we can use
|
499.2.12
by Mark Atwood
have logging_query.cc call gettimeofday, since we cant get it from the thd |
54 |
will have to use this instead */
|
55 |
||
56 |
static uint64_t get_microtime() |
|
57 |
{
|
|
58 |
#if defined(HAVE_GETHRTIME)
|
|
59 |
return gethrtime()/1000; |
|
60 |
#else
|
|
61 |
uint64_t newtime; |
|
62 |
struct timeval t; |
|
63 |
/*
|
|
64 |
The following loop is here because gettimeofday may fail on some systems
|
|
65 |
*/
|
|
499.2.14
by Mark Atwood
fixes as per MontyT's comments, prep for internationalization |
66 |
while (gettimeofday(&t, NULL) != 0) {} |
499.2.12
by Mark Atwood
have logging_query.cc call gettimeofday, since we cant get it from the thd |
67 |
newtime= (uint64_t)t.tv_sec * 1000000 + t.tv_usec; |
68 |
return newtime; |
|
69 |
#endif /* defined(HAVE_GETHRTIME) */ |
|
70 |
}
|
|
71 |
||
812.1.1
by Mark Atwood
fixup logging plugin, make it compile in, and make it do CSV |
72 |
/* quote a string to be safe to include in a CSV line
|
73 |
that means backslash quoting all commas, doublequotes, backslashes,
|
|
74 |
and all the ASCII unprintable characters
|
|
75 |
as long as we pass the high-bit bytes unchanged
|
|
76 |
this is safe to do to a UTF8 string
|
|
812.1.6
by Mark Atwood
logging to syslog |
77 |
we dont allow overrunning the targetbuffer
|
78 |
to avoid having a very long query overwrite memory
|
|
812.1.1
by Mark Atwood
fixup logging plugin, make it compile in, and make it do CSV |
79 |
|
80 |
TODO consider remapping the unprintables instead to "Printable
|
|
81 |
Representation", the Unicode characters from the area U+2400 to
|
|
82 |
U+2421 reserved for representing control characters when it is
|
|
83 |
necessary to print or display them rather than have them perform
|
|
84 |
their intended function.
|
|
85 |
||
86 |
*/
|
|
87 |
||
1607.1.1
by David Shrewsbury
Replace static buffers with std::string. |
88 |
static void quotify(const string &src, string &dst) |
812.1.1
by Mark Atwood
fixup logging plugin, make it compile in, and make it do CSV |
89 |
{
|
779.5.1
by Monty Taylor
Merged Mark. |
90 |
static const char hexit[]= { '0', '1', '2', '3', '4', '5', '6', '7', |
812.1.1
by Mark Atwood
fixup logging plugin, make it compile in, and make it do CSV |
91 |
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; |
1607.1.1
by David Shrewsbury
Replace static buffers with std::string. |
92 |
string::const_iterator src_iter; |
93 |
||
94 |
for (src_iter= src.begin(); src_iter < src.end(); ++src_iter) |
|
812.1.3
by Mark Atwood
fix style |
95 |
{
|
1607.1.1
by David Shrewsbury
Replace static buffers with std::string. |
96 |
if (static_cast<unsigned char>(*src_iter) > 0x7f) |
97 |
{
|
|
98 |
dst.push_back(*src_iter); |
|
99 |
}
|
|
100 |
else if (*src_iter == 0x00) // null |
|
101 |
{
|
|
102 |
dst.push_back(ESCAPE_CHAR); dst.push_back('0'); |
|
103 |
}
|
|
104 |
else if (*src_iter == 0x07) // bell |
|
105 |
{
|
|
106 |
dst.push_back(ESCAPE_CHAR); dst.push_back('a'); |
|
107 |
}
|
|
108 |
else if (*src_iter == 0x08) // backspace |
|
109 |
{
|
|
110 |
dst.push_back(ESCAPE_CHAR); dst.push_back('b'); |
|
111 |
}
|
|
112 |
else if (*src_iter == 0x09) // horiz tab |
|
113 |
{
|
|
114 |
dst.push_back(ESCAPE_CHAR); dst.push_back('t'); |
|
115 |
}
|
|
116 |
else if (*src_iter == 0x0a) // line feed |
|
117 |
{
|
|
118 |
dst.push_back(ESCAPE_CHAR); dst.push_back('n'); |
|
119 |
}
|
|
120 |
else if (*src_iter == 0x0b) // vert tab |
|
121 |
{
|
|
122 |
dst.push_back(ESCAPE_CHAR); dst.push_back('v'); |
|
123 |
}
|
|
124 |
else if (*src_iter == 0x0c) // formfeed |
|
125 |
{
|
|
126 |
dst.push_back(ESCAPE_CHAR); dst.push_back('f'); |
|
127 |
}
|
|
128 |
else if (*src_iter == 0x0d) // carrage return |
|
129 |
{
|
|
130 |
dst.push_back(ESCAPE_CHAR); dst.push_back('r'); |
|
131 |
}
|
|
132 |
else if (*src_iter == 0x1b) // escape |
|
133 |
{
|
|
134 |
dst.push_back(ESCAPE_CHAR); dst.push_back('e'); |
|
135 |
}
|
|
136 |
else if (*src_iter == 0x22) // quotation mark |
|
137 |
{
|
|
138 |
dst.push_back(ESCAPE_CHAR); dst.push_back(0x22); |
|
139 |
}
|
|
140 |
else if (*src_iter == SEPARATOR_CHAR) |
|
141 |
{
|
|
142 |
dst.push_back(ESCAPE_CHAR); dst.push_back(SEPARATOR_CHAR); |
|
143 |
}
|
|
144 |
else if (*src_iter == ESCAPE_CHAR) |
|
145 |
{
|
|
146 |
dst.push_back(ESCAPE_CHAR); dst.push_back(ESCAPE_CHAR); |
|
147 |
}
|
|
148 |
else if ((*src_iter < 0x20) || (*src_iter == 0x7F)) // other unprintable ASCII |
|
149 |
{
|
|
150 |
dst.push_back(ESCAPE_CHAR); |
|
151 |
dst.push_back('x'); |
|
152 |
dst.push_back(hexit[(*src_iter >> 4) & 0x0f]); |
|
153 |
dst.push_back(hexit[*src_iter & 0x0f]); |
|
812.1.3
by Mark Atwood
fix style |
154 |
}
|
155 |
else // everything else |
|
156 |
{
|
|
1607.1.1
by David Shrewsbury
Replace static buffers with std::string. |
157 |
dst.push_back(*src_iter); |
812.1.3
by Mark Atwood
fix style |
158 |
}
|
812.1.1
by Mark Atwood
fixup logging plugin, make it compile in, and make it do CSV |
159 |
}
|
160 |
}
|
|
161 |
||
162 |
||
1130.1.1
by Monty Taylor
Merged in plugin-slot-reorg patches. |
163 |
class Logging_query: public drizzled::plugin::Logging |
958.1.1
by Monty Taylor
Made logging plugin class based. |
164 |
{
|
1039.4.6
by Mark Atwood
make logging_query be more C++ ish |
165 |
int fd; |
166 |
pcre *re; |
|
167 |
pcre_extra *pe; |
|
168 |
||
1607.1.2
by David Shrewsbury
Made the boost::format object reusable. |
169 |
/** Format of the output string */
|
170 |
boost::format formatter; |
|
171 |
||
968.2.33
by Monty Taylor
Removed plugin_foreach from logging_handler. |
172 |
public: |
1039.4.6
by Mark Atwood
make logging_query be more C++ ish |
173 |
|
1130.1.1
by Monty Taylor
Merged in plugin-slot-reorg patches. |
174 |
Logging_query() |
175 |
: drizzled::plugin::Logging("Logging_query"), |
|
1607.1.2
by David Shrewsbury
Made the boost::format object reusable. |
176 |
fd(-1), re(NULL), pe(NULL), |
177 |
formatter("%1%,%2%,%3%,\"%4%\",\"%5%\",\"%6%\",%7%,%8%," |
|
178 |
"%9%,%10%,%11%,%12%,%13%,%14%,\"%15%\"\n") |
|
1039.4.6
by Mark Atwood
make logging_query be more C++ ish |
179 |
{
|
180 |
||
181 |
/* if there is no destination filename, dont bother doing anything */
|
|
182 |
if (sysvar_logging_query_filename == NULL) |
|
183 |
return; |
|
184 |
||
185 |
fd= open(sysvar_logging_query_filename, |
|
186 |
O_WRONLY | O_APPEND | O_CREAT, |
|
187 |
S_IRUSR|S_IWUSR); |
|
188 |
if (fd < 0) |
|
189 |
{
|
|
1702.3.2
by LinuxJedi
Migrate the rest of strerror to strerror_r |
190 |
char errmsg[STRERROR_MAX]; |
191 |
strerror_r(errno, errmsg, sizeof(errmsg)); |
|
1039.4.6
by Mark Atwood
make logging_query be more C++ ish |
192 |
errmsg_printf(ERRMSG_LVL_ERROR, _("fail open() fn=%s er=%s\n"), |
193 |
sysvar_logging_query_filename, |
|
1702.3.2
by LinuxJedi
Migrate the rest of strerror to strerror_r |
194 |
errmsg); |
1039.4.6
by Mark Atwood
make logging_query be more C++ ish |
195 |
return; |
196 |
}
|
|
197 |
||
198 |
if (sysvar_logging_query_pcre != NULL) |
|
199 |
{
|
|
200 |
const char *this_pcre_error; |
|
201 |
int this_pcre_erroffset; |
|
202 |
re= pcre_compile(sysvar_logging_query_pcre, 0, &this_pcre_error, |
|
203 |
&this_pcre_erroffset, NULL); |
|
204 |
pe= pcre_study(re, 0, &this_pcre_error); |
|
205 |
/* TODO emit error messages if there is a problem */
|
|
206 |
}
|
|
207 |
}
|
|
968.2.33
by Monty Taylor
Removed plugin_foreach from logging_handler. |
208 |
|
1039.4.8
by Mark Atwood
add destructor to logging_query, to close filehandle and clean up PCRE stuff |
209 |
~Logging_query() |
210 |
{
|
|
211 |
if (fd >= 0) |
|
212 |
{
|
|
213 |
close(fd); |
|
214 |
}
|
|
215 |
||
216 |
if (pe != NULL) |
|
217 |
{
|
|
218 |
pcre_free(pe); |
|
219 |
}
|
|
220 |
||
221 |
if (re != NULL) |
|
222 |
{
|
|
223 |
pcre_free(re); |
|
224 |
}
|
|
225 |
}
|
|
226 |
||
958.1.1
by Monty Taylor
Made logging plugin class based. |
227 |
virtual bool post (Session *session) |
228 |
{
|
|
1607.1.1
by David Shrewsbury
Replace static buffers with std::string. |
229 |
size_t wrv; |
958.1.1
by Monty Taylor
Made logging plugin class based. |
230 |
|
231 |
assert(session != NULL); |
|
232 |
||
233 |
if (fd < 0) |
|
234 |
return false; |
|
235 |
||
236 |
/* Yes, we know that checking sysvar_logging_query_enable,
|
|
237 |
sysvar_logging_query_threshold_big_resultset, and
|
|
238 |
sysvar_logging_query_threshold_big_examined is not threadsafe,
|
|
239 |
because some other thread might change these sysvars. But we
|
|
240 |
don't care. We might start logging a little late as it spreads
|
|
241 |
to other threads. Big deal. */
|
|
242 |
||
243 |
// return if not enabled or query was too fast or resultset was too small
|
|
244 |
if (sysvar_logging_query_enable == false) |
|
245 |
return false; |
|
246 |
if (session->sent_row_count < sysvar_logging_query_threshold_big_resultset) |
|
247 |
return false; |
|
248 |
if (session->examined_row_count < sysvar_logging_query_threshold_big_examined) |
|
249 |
return false; |
|
250 |
||
251 |
/* TODO, the session object should have a "utime command completed"
|
|
252 |
inside itself, so be more accurate, and so this doesnt have to
|
|
253 |
keep calling current_utime, which can be slow */
|
|
254 |
||
255 |
uint64_t t_mark= get_microtime(); |
|
256 |
||
257 |
if ((t_mark - session->start_utime) < (sysvar_logging_query_threshold_slow)) |
|
258 |
return false; |
|
1039.4.5
by Mark Atwood
add PCRE matching to logging to file |
259 |
|
260 |
if (re) |
|
261 |
{
|
|
262 |
int this_pcre_rc; |
|
1607.1.1
by David Shrewsbury
Replace static buffers with std::string. |
263 |
this_pcre_rc= pcre_exec(re, pe, session->query.c_str(), session->query.length(), 0, 0, NULL, 0); |
1039.4.5
by Mark Atwood
add PCRE matching to logging to file |
264 |
if (this_pcre_rc < 0) |
265 |
return false; |
|
266 |
}
|
|
267 |
||
958.1.1
by Monty Taylor
Made logging plugin class based. |
268 |
// buffer to quotify the query
|
1607.1.1
by David Shrewsbury
Replace static buffers with std::string. |
269 |
string qs; |
270 |
||
271 |
// Since quotify() builds the quoted string incrementally, we can
|
|
272 |
// avoid some reallocating if we reserve some space up front.
|
|
273 |
qs.reserve(session->getQueryLength()); |
|
274 |
||
275 |
quotify(session->getQueryString(), qs); |
|
276 |
||
958.1.1
by Monty Taylor
Made logging plugin class based. |
277 |
// to avoid trying to printf %s something that is potentially NULL
|
1220.1.9
by Brian Aker
Remove char *db from session, and replaces it with std::string. |
278 |
const char *dbs= session->db.empty() ? "" : session->db.c_str(); |
1607.1.1
by David Shrewsbury
Replace static buffers with std::string. |
279 |
|
280 |
formatter % t_mark |
|
281 |
% session->thread_id |
|
282 |
% session->getQueryId() |
|
283 |
% dbs |
|
284 |
% qs |
|
285 |
% command_name[session->command].str |
|
286 |
% (t_mark - session->getConnectMicroseconds()) |
|
287 |
% (t_mark - session->start_utime) |
|
288 |
% (t_mark - session->utime_after_lock) |
|
289 |
% session->sent_row_count |
|
290 |
% session->examined_row_count |
|
291 |
% session->tmp_table |
|
292 |
% session->total_warn_count |
|
293 |
% session->getServerId() |
|
294 |
% glob_hostname; |
|
295 |
||
296 |
string msgbuf= formatter.str(); |
|
297 |
||
958.1.1
by Monty Taylor
Made logging plugin class based. |
298 |
// a single write has a kernel thread lock, thus no need mutex guard this
|
1607.1.1
by David Shrewsbury
Replace static buffers with std::string. |
299 |
wrv= write(fd, msgbuf.c_str(), msgbuf.length()); |
300 |
assert(wrv == msgbuf.length()); |
|
301 |
||
958.1.1
by Monty Taylor
Made logging plugin class based. |
302 |
return false; |
303 |
}
|
|
304 |
};
|
|
383.6.1
by Mark Atwood
add pluggable logging |
305 |
|
971.1.51
by Monty Taylor
New-style plugin registration now works. |
306 |
static Logging_query *handler= NULL; |
307 |
||
1530.2.6
by Monty Taylor
Moved plugin::Context to module::Context. |
308 |
static int logging_query_plugin_init(drizzled::module::Context &context) |
383.6.1
by Mark Atwood
add pluggable logging |
309 |
{
|
1660.7.1
by Vijay Samuel
Merge re factored commandline for logging_query using boost::program_options |
310 |
|
311 |
const module::option_map &vm= context.getOptions(); |
|
312 |
if (vm.count("threshold-slow")) |
|
313 |
{
|
|
314 |
if (sysvar_logging_query_threshold_slow > UINT32_MAX) |
|
315 |
{
|
|
316 |
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for threshold-slow")); |
|
317 |
exit(-1); |
|
318 |
}
|
|
319 |
}
|
|
320 |
||
321 |
if (vm.count("threshold-big-resultset")) |
|
322 |
{
|
|
323 |
if (sysvar_logging_query_threshold_big_resultset > UINT32_MAX) |
|
324 |
{
|
|
325 |
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for threshold-big-resultset")); |
|
326 |
exit(-1); |
|
327 |
}
|
|
328 |
}
|
|
329 |
||
330 |
if (vm.count("threshold-big-examined")) |
|
331 |
{
|
|
332 |
if (sysvar_logging_query_threshold_big_examined > UINT32_MAX) |
|
333 |
{
|
|
334 |
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for threshold-big-examined")); |
|
335 |
exit(-1); |
|
336 |
}
|
|
337 |
}
|
|
971.1.51
by Monty Taylor
New-style plugin registration now works. |
338 |
handler= new Logging_query(); |
1324.2.2
by Monty Taylor
Use the plugin::Context everywhere. |
339 |
context.add(handler); |
383.6.1
by Mark Atwood
add pluggable logging |
340 |
|
341 |
return 0; |
|
342 |
}
|
|
343 |
||
1660.7.1
by Vijay Samuel
Merge re factored commandline for logging_query using boost::program_options |
344 |
static void init_options(drizzled::module::option_context &context) |
345 |
{
|
|
346 |
context("enable", |
|
347 |
po::value<bool>(&sysvar_logging_query_enable)->default_value(false)->zero_tokens(), |
|
348 |
N_("Enable logging to CSV file")); |
|
349 |
context("threshold-slow", |
|
350 |
po::value<unsigned long>(&sysvar_logging_query_threshold_slow)->default_value(0), |
|
351 |
N_("Threshold for logging slow queries, in microseconds")); |
|
352 |
context("threshold-big-resultset", |
|
353 |
po::value<unsigned long>(&sysvar_logging_query_threshold_big_resultset)->default_value(0), |
|
354 |
N_("Threshold for logging big queries, for rows returned")); |
|
355 |
context("threshold-big-examined", |
|
356 |
po::value<unsigned long>(&sysvar_logging_query_threshold_big_examined)->default_value(0), |
|
357 |
N_("Threshold for logging big queries, for rows examined")); |
|
358 |
}
|
|
359 |
||
812.1.6
by Mark Atwood
logging to syslog |
360 |
static DRIZZLE_SYSVAR_BOOL( |
361 |
enable, |
|
362 |
sysvar_logging_query_enable, |
|
363 |
PLUGIN_VAR_NOCMDARG, |
|
364 |
N_("Enable logging to CSV file"), |
|
365 |
NULL, /* check func */ |
|
366 |
NULL, /* update func */ |
|
367 |
false /* default */); |
|
368 |
||
499.2.14
by Mark Atwood
fixes as per MontyT's comments, prep for internationalization |
369 |
static DRIZZLE_SYSVAR_STR( |
370 |
filename, |
|
812.1.6
by Mark Atwood
logging to syslog |
371 |
sysvar_logging_query_filename, |
438.2.2
by Mark Atwood
sysvar for filename for pluggable query logging to log to |
372 |
PLUGIN_VAR_READONLY, |
499.2.14
by Mark Atwood
fixes as per MontyT's comments, prep for internationalization |
373 |
N_("File to log to"), |
374 |
NULL, /* check func */ |
|
375 |
NULL, /* update func*/ |
|
376 |
NULL /* default */); |
|
377 |
||
1039.4.5
by Mark Atwood
add PCRE matching to logging to file |
378 |
static DRIZZLE_SYSVAR_STR( |
379 |
pcre, |
|
380 |
sysvar_logging_query_pcre, |
|
381 |
PLUGIN_VAR_READONLY, |
|
382 |
N_("PCRE to match the query against"), |
|
383 |
NULL, /* check func */ |
|
384 |
NULL, /* update func*/ |
|
385 |
NULL /* default */); |
|
386 |
||
499.2.14
by Mark Atwood
fixes as per MontyT's comments, prep for internationalization |
387 |
static DRIZZLE_SYSVAR_ULONG( |
812.1.1
by Mark Atwood
fixup logging plugin, make it compile in, and make it do CSV |
388 |
threshold_slow, |
812.1.6
by Mark Atwood
logging to syslog |
389 |
sysvar_logging_query_threshold_slow, |
499.2.14
by Mark Atwood
fixes as per MontyT's comments, prep for internationalization |
390 |
PLUGIN_VAR_OPCMDARG, |
391 |
N_("Threshold for logging slow queries, in microseconds"), |
|
392 |
NULL, /* check func */ |
|
393 |
NULL, /* update func */ |
|
394 |
0, /* default */ |
|
395 |
0, /* min */ |
|
779.5.2
by Monty Taylor
Few more style fixes. |
396 |
UINT32_MAX, /* max */ |
499.2.14
by Mark Atwood
fixes as per MontyT's comments, prep for internationalization |
397 |
0 /* blksiz */); |
398 |
||
399 |
static DRIZZLE_SYSVAR_ULONG( |
|
499.2.15
by Mark Atwood
change thresh_bigexa to threadhold_big_examined. "Use English!" --BrianA |
400 |
threshold_big_resultset, |
812.1.6
by Mark Atwood
logging to syslog |
401 |
sysvar_logging_query_threshold_big_resultset, |
499.2.14
by Mark Atwood
fixes as per MontyT's comments, prep for internationalization |
402 |
PLUGIN_VAR_OPCMDARG, |
403 |
N_("Threshold for logging big queries, for rows returned"), |
|
404 |
NULL, /* check func */ |
|
405 |
NULL, /* update func */ |
|
406 |
0, /* default */ |
|
407 |
0, /* min */ |
|
779.5.2
by Monty Taylor
Few more style fixes. |
408 |
UINT32_MAX, /* max */ |
499.2.14
by Mark Atwood
fixes as per MontyT's comments, prep for internationalization |
409 |
0 /* blksiz */); |
410 |
||
411 |
static DRIZZLE_SYSVAR_ULONG( |
|
812.1.1
by Mark Atwood
fixup logging plugin, make it compile in, and make it do CSV |
412 |
threshold_big_examined, |
812.1.6
by Mark Atwood
logging to syslog |
413 |
sysvar_logging_query_threshold_big_examined, |
499.2.14
by Mark Atwood
fixes as per MontyT's comments, prep for internationalization |
414 |
PLUGIN_VAR_OPCMDARG, |
415 |
N_("Threshold for logging big queries, for rows examined"), |
|
416 |
NULL, /* check func */ |
|
417 |
NULL, /* update func */ |
|
418 |
0, /* default */ |
|
419 |
0, /* min */ |
|
779.5.2
by Monty Taylor
Few more style fixes. |
420 |
UINT32_MAX, /* max */ |
499.2.14
by Mark Atwood
fixes as per MontyT's comments, prep for internationalization |
421 |
0 /* blksiz */); |
438.2.2
by Mark Atwood
sysvar for filename for pluggable query logging to log to |
422 |
|
1228.1.5
by Monty Taylor
Merged in some naming things. |
423 |
static drizzle_sys_var* logging_query_system_variables[]= { |
812.1.6
by Mark Atwood
logging to syslog |
424 |
DRIZZLE_SYSVAR(enable), |
438.2.2
by Mark Atwood
sysvar for filename for pluggable query logging to log to |
425 |
DRIZZLE_SYSVAR(filename), |
1039.4.5
by Mark Atwood
add PCRE matching to logging to file |
426 |
DRIZZLE_SYSVAR(pcre), |
812.1.1
by Mark Atwood
fixup logging plugin, make it compile in, and make it do CSV |
427 |
DRIZZLE_SYSVAR(threshold_slow), |
499.2.15
by Mark Atwood
change thresh_bigexa to threadhold_big_examined. "Use English!" --BrianA |
428 |
DRIZZLE_SYSVAR(threshold_big_resultset), |
812.1.1
by Mark Atwood
fixup logging plugin, make it compile in, and make it do CSV |
429 |
DRIZZLE_SYSVAR(threshold_big_examined), |
438.2.2
by Mark Atwood
sysvar for filename for pluggable query logging to log to |
430 |
NULL
|
431 |
};
|
|
432 |
||
1228.1.5
by Monty Taylor
Merged in some naming things. |
433 |
DRIZZLE_DECLARE_PLUGIN
|
383.6.1
by Mark Atwood
add pluggable logging |
434 |
{
|
1241.10.2
by Monty Taylor
Added support for embedding the drizzle version number in the plugin file. |
435 |
DRIZZLE_VERSION_ID, |
1660.7.1
by Vijay Samuel
Merge re factored commandline for logging_query using boost::program_options |
436 |
"logging-query", |
812.1.6
by Mark Atwood
logging to syslog |
437 |
"0.2", |
383.6.1
by Mark Atwood
add pluggable logging |
438 |
"Mark Atwood <mark@fallenpegasus.com>", |
812.1.6
by Mark Atwood
logging to syslog |
439 |
N_("Log queries to a CSV file"), |
383.6.1
by Mark Atwood
add pluggable logging |
440 |
PLUGIN_LICENSE_GPL, |
383.6.5
by Mark Atwood
start renaming logging_noop to logging_query |
441 |
logging_query_plugin_init, |
438.2.2
by Mark Atwood
sysvar for filename for pluggable query logging to log to |
442 |
logging_query_system_variables, |
1660.7.1
by Vijay Samuel
Merge re factored commandline for logging_query using boost::program_options |
443 |
init_options
|
383.6.1
by Mark Atwood
add pluggable logging |
444 |
}
|
1228.1.5
by Monty Taylor
Merged in some naming things. |
445 |
DRIZZLE_DECLARE_PLUGIN_END; |