MySQL Logging

  • Updated


Log Database Queries with Embedded MySQL

Enterprise-on-Premises (EOP) customers can use the embedded MySQL instance packaged with Contrast or integrate Contrast with a distributed MySQL instance. For customers leveraging the embedded MySQL instance, Contrast provides a configurable property file in $CONTRAST_HOME/data/conf/ This file is very similar to the my.cnf file that is leveraged natively within MySQL.


Two logging flags are available: general logging and slow query logging.

General logging is used to log every statement executed by MySQL. Customers who use this option should be very careful, as this log can grow to many 100s of gigabytes of storage over a very short window of time. Contrast recommends that you use general logging only for debugging purposes and that you disable it at all other times.

Slow query logging is used to evaluate queries that take a particularly long period of time. MySQL monitors the SQL and measures the time it takes to execute. When enabled, this log grows from many megabytes to gigabytes depending on whether a system is very slow. Contrast recommends that you keep this option enabled, but that you pay close attention to the size of the log file over time.


Sample Properties File

An example from the file created with Contrast as part of an embedded installation/upgrade:


# The destination for general query log and slow query log output

# Log errors and startup messages to this file

# Whether the slow query log is enabled. "Slow" is determined by the value of the long_query_time variable
#The name of the slow query log file



Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request