Skip to content

Disabling the Percona general_log

Disabling the Percona general_log in Percona Issues.

4 min read Updated SS RS

Disabling the Percona general_log#

The general_log that can be enabled will be only an on-demand basis. Since there is no log rotation policy it generates huge logs as it logs every query and activity on the Percona.

Follow the below steps to disable percona general_logs :

  1. Stop percona.

    nomad stop percona
    

    Expected Output:

    ==> 2023-08-30T12:31:22+05:30: Monitoring evaluation "b311ebe1"
        2023-08-30T12:31:22+05:30: Evaluation triggered by job "percona"
        2023-08-30T12:31:23+05:30: Evaluation within deployment:
    "09166a18"
        2023-08-30T12:31:23+05:30: Evaluation status changed: "pending"
    -> "complete"
    ==> 2023-08-30T12:31:23+05:30: Evaluation "b311ebe1" finished with
    status "complete"
    ==> 2023-08-30T12:31:23+05:30: Monitoring deployment "09166a18"
         ✓ Deployment "09166a18" successful
    
    
              2023-08-30T12:31:23+05:30
              ID          = 09166a18
              Job ID      = percona
              Job Version = 2
              Status      = successful
              Description = Deployment completed successfully
    
        Deployed
        Task Group                             Desired   Placed   Healthy   Unhealthy   Progress
    Deadline
        percona-node1                          1         1        1         0           2023-08-
    29T15:27:53+05:30
        percona-node2                          1         1        1         0           2023-08-
    29T15:28:07+05:30
    
  2. Navigate to below directory:

    a1home
    
  3. Navigate to percona centralized logs,

    cd centralized logs/percona
    

    Expected Output:

    [root@localhost opensearch-node1]# ll
    total 192
    -rw-rw-r--. 1 appsone 51280 Aug 28 05:33
    opensearch_20230827.log.gz
    -rw-rw-r--. 1 appsone 141078 Aug 30 12:18 opensearch.log
    
  4. Delete percona logs, by executing the below command in the above directory.

    rm -rf *.log
    

    Expected output: After executing the above command, there wont be any information but the command will be executed successfully.

  5. Disable the general_log in Percona by following the below steps.

    1. Navigate to below path:

      <Appsone_Installation_Path>/Appsone_Service/conf/PERCONA
      

      For Example:

      cd opt/heal/Appsone_Service/conf/PERCONA
      
    2. List the files in Percona:

      [root@localhost PERCONA]# ll
      total 12
      -rw-rw-r--. 1 appsone root 1604 Jun 27 12:26 my.cnf
      
    3. Navigate inside the my.cnf file and edit the general_log value.

      vi my.cnf
      

      Expected Output:

      # Appnomic Systems Private, LTD.
      # AppsOne My.Cnf file
      
      
      # The MySQL server
      [mysqld]
      server_id = 1
      event_scheduler = 1
      tls_version=TLSv1.2,TLSv1.3
      local-infile = 0
      symbolic-links = 0
      
      # These two parameters are used for TMP tables and MUST be the same
      size
      max_heap_table_size=100M
      tmp_table_size=100M
      slave-skip-errors = 1007,1396,1146,1062,1032,1060,1507,1045,1517
      
      
      # Enable the performance schema
      binlog_expire_logs_seconds = 86400
      max_binlog_size = 1048576000
      binlog_expire_logs_seconds = 86400
      max_binlog_size = 1048576000
      performance_schema
      relay_log = server1-relay-bin
      
      
      sql_mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR
      _DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"
      plugin-load-add = validate_password.so
      validate_password_length=6
      validate_password_policy=LOW
      
      # log related
      general_log = on
      general_log_file = /tmp/logs/mysql.log
      log_error=/tmp/logs/mysql-error.log
      
      
      [client]
      ssl-ca=/var/lib/mysql/ca.pem
      ssl-cert=/var/lib/mysql/client-cert.pem
      ssl-key=/var/lib/mysql/client-key.pem
      

      In my.conf file, under log related section - edit the line general_log as off (general_log = off).

  6. Start percona.

    nomad run percona.nomad
    

    Expected Output:

    ==> 2023-08-30T12:31:38+05:30: Monitoring evaluation "49a27fb5"
        2023-08-30T12:31:38+05:30: Evaluation triggered by job "percona"
        2023-08-30T12:31:39+05:30: Evaluation within deployment:
    "04973314"
        2023-08-30T12:31:39+05:30: Allocation "0a2db17c" created: node
    "a066a76a", group "percona-node1"
        2023-08-30T12:31:39+05:30: Allocation "3acab413" created: node
    "5681f4b3", group "percona-node2"
        2023-08-30T12:31:39+05:30: Evaluation status changed: "pending"
    -> "complete"
    ==> 2023-08-30T12:31:39+05:30: Evaluation "49a27fb5" finished with
    status "complete"
    ==> 2023-08-30T12:31:39+05:30: Monitoring deployment "04973314"
      ⠼ Deployment "04973314" in progress...
    
              2023-08-30T12:31:39+05:30
              ID          = 04973314
              Job ID                       = percona
              Job Version                  = 4
              Status                       = running
              Description                  = Deployment is running
    
    
        Deployed
        Task Group                             Desired   Placed   Healthy   Unhealthy   Progress
    Deadline
        percona-node1                          1         1        0         0           2023-08-
    30T12:41:38+05:30
        percona-node2                          1         1        0         0           2023-08-
    30T12:41:38+05:30
    

    Note: Mysql still writes errors in the mysql-error.log (these error logs are needed in most of the cases).

Percona Container Fails to Start#

  1. The percona container is not starting with error API-500 error.

    Failed t o creat e cont ainer: API error (500) open (in this case because of "McAfee Solidifier").

  2. In the daemon.js on file, add the storage driver configuration,

    {
         "storage-driver": "devicemapper"
    }
    

Steps to enable additional parameters for Percona audit-log#

Follow the below steps to rectify the issue:

  1. Add parameters to rotate audit logs : Add the following parameters under the log-related section to rotate the audit logs.

    Configure the below parameters with your custom values:

    audit_log_format=JSON
    audit_log_rotate_on_size=4M
    audit_log_rotations=4
    

    screenshot

  2. Change audit.log file path : By default, audit logs are generated under

    <>/Appsone_Service/data/percona
    

    If you want to change the audit.log file path, use the below path under my.cnf .

    audit_log_file=/var/log/mysql/audit.log
    

    screenshot

  3. Verify plugin installation : After adding the parameters, log in to Percona and execute the following queries:

    mysql> SELECT * FROM information_schema.PLUGINS WHERE PLUGIN_NAME
    LIKE '%audit%';
    Empty set (0.00 sec)
    mysql> SHOW variables LIKE 'audit%';
    Empty set (0.01 sec)
    SHOW variables LIKE 'plugin%';
    +---------------+------------------------+
    | Variable_name | Value |
    +---------------+------------------------+
    | plugin_dir | /usr/lib/mysql/plugin/ |
    +---------------+------------------------+
    

    If the output is similar to the above, proceed to the next step.

  4. Install plugin : Execute the following command to install the plugin:

    mysql> INSTALL PLUGIN audit_log SONAME 'audit_log.so';
    

    The output should indicate that the plugin was created.

  5. Verify plugin details : Execute the following command to verify that the plugin details were added:

    SELECT * FROM information_schema.PLUGINS WHERE PLUGIN_NAME LIKE
    '%audit%'\G
    

    The output should show the plugin details added in previous steps.

  6. Validate audit.log : Validate the audit.log under the Percona data directory for Database User ID/Name, User Privilege.

    screenshot