A
A
Andrey2017-10-18 14:08:01
MySQL
Andrey, 2017-10-18 14:08:01

Is it possible to enable general_log for a specific query?

Is it possible to somehow enable not general mysql logging, but only a specific query?
because there are a lot of requests and in an hour the log hangs up already 2 gigabytes and it is necessary to monitor during the week only the execution of some specific request.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Pavlenko, 2017-10-18
@VELIK505

I think yes.
First, in the MySQL config, set:
general_log_file = /var/log/mysql/general.log
And then, before the desired query, try to include: SET GLOBAL general_log = 'ON';, and after - SET GLOBAL general_log = 'OFF';
Most likely, other, unnecessary requests will cling at this time, but at least the size of the logs will not be so large

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question