metakgp / metakgp-wiki

Dockerized source for the metakgp wiki.
https://wiki.metakgp.org
GNU General Public License v3.0
23 stars 20 forks source link

Enable error logging for the MySQL container #73

Closed icyflame closed 6 months ago

icyflame commented 4 years ago

Currently, the MySQL container is not writing any query logs at all. Erroneous query logs are written to stderr.

# Last lines of the mysql error log
icyflame@metakgp-blr:~$ docker exec -it metakgp-wiki_mysql_1 tail /var/log/mysql/error.log
2018-02-26T23:11:59.997694Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 180226 23:11:59
2018-02-26T23:12:01.707688Z 0 [Note] InnoDB: Shutdown completed; log sequence number 2551387
2018-02-26T23:12:01.709698Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2018-02-26T23:12:01.709711Z 0 [Note] Shutting down plugin 'MEMORY'
2018-02-26T23:12:01.709716Z 0 [Note] Shutting down plugin 'CSV'
2018-02-26T23:12:01.709720Z 0 [Note] Shutting down plugin 'sha256_password'
2018-02-26T23:12:01.709723Z 0 [Note] Shutting down plugin 'mysql_native_password'
2018-02-26T23:12:01.709892Z 0 [Note] Shutting down plugin 'binlog'
2018-02-26T23:12:01.711473Z 0 [Note] mysqld: Shutdown complete

These are the last few lines in the Error log and they were written back in February 2018. I checked the Global variables that enable logging, and they are not set properly.

mysql> SELECT @@global.general_log;
+----------------------+
| @@global.general_log |
+----------------------+
|                    0 |
+----------------------+
1 row in set (0.00 sec)mysql> SELECT @@global.general_log_file;
+---------------------------------+
| @@global.general_log_file       |
+---------------------------------+
| /var/lib/mysql/4efb1f830bf6.log |
+---------------------------------+
1 row in set (0.00 sec)mysql> SELECT @@global.log_output;
+---------------------+
| @@global.log_output |
+---------------------+
| FILE                |
+---------------------+
1 row in set (0.00 sec)

We have to set general_log = 1 in the MySQL configuration file. We are not currently using one in this repository. We have to start using it when we build the mysql Docker image.

The configuration file has to be written with some basic options and then inserted into the correct path. More documentation on this can be found on the webpage for the official mysql docker image under the Using a custom MySQL configuration file section.

shikharish commented 6 months ago

@harshkhandeparkar What is the status of this issue?

harshkhandeparkar commented 6 months ago

@shikharish please don't work on any issue before being assigned :) This time it is fine since you were the only one interested to work on it.