AppDynamics for Databases

2.9.x Documentation

MySQL provides a built-in function called load_file which is capable of reading a file from the file system and returning the results as a single column single row result set via SQL. This function can be used to read the error log using the following technique:

  1. Locate the MySQL Error Log, from a command shell enter the following:

    C:\> C:\AppD4DBInstallDir\mysql\bin\startClient.bat
    mysql> show variables like 'log_error';
    

    The system should return something like the following:

    +-------------------------------------------------------------------+
    |  Variable_name | Value                                            |
    +-------------------------------------------------------------------+
    | log_error      | C:\AppD4DBInstallDir\mysql\data\hostname.err     |
    +-------------------------------------------------------------------+
  2. Check that you can read the file from the command line:

    mysql> select load_file ('C:\AppD4DBInstallDir\mysql\data\hostname.err');
    

    You can then use a custom SQL alert to monitor the log file by creating a diff alert, which will notify you of changes to the log file:

  3.  Click Alerts->New Alert and then click Custom SQL Alert.
  4. Paste the "select load_file( 'file name...' )" command in as the SQL Text text box.
  5. Set Threshold to "0".
  6. For the Return Type specify "Diff Results".
  7. Specify a name for the Alert Name.
    AppDynamics for Databases will report on differences in the new log messages.

    For example: