MySQL Telemetry and OCI Log Analytics
Exports MySQL server logs to OCI Log Analytics.
Prerequisites
Prerequisites for sending MySQL Logs to OCI Log Analytics.
To send MySQL Logs to OCI Log Analytics, ensure the following:
- You have access to the OCI Log Analytics service and appropriate
permissions.
Note
Log Analytics is a billable service, it is not included in your MySQL HeatWave Service subscription and must be activated separately. See Log Analytics for more information. - You have created at least one Log Analytics Log Group. This is required to store the MySQL logs.
- Your DB System runs MySQL version 9.6.1 or higher.
- You DB System is standalone. Exporting MySQL logs to OCI Log Analytics is not currently supported by High Availability DB Systems or DB Systems with Read Replicas.
- Your DB System is not Always-free-tier, which has no access to Log Analytics.
- You have defined IAM policies as described in Policies.
- To log SQL statements in the Audit Log, you must define Audit Log filters. See Audit Log Filtering.
MySQL Logs
Exports MySQL server logs to OCI Log Analytics or to custom OpenTelemetry endpoints.
The following logs can be exported:
- Error log: Contains a record of mysqld startup and shutdown times. It also contains diagnostic messages such as errors, warnings, and notes that occur during server startup and shutdown, and while the server is running.
- Slow query log: Consists of SQL statements that take more than
long_query_timeseconds to execute and require at leastmin_examined_row_limitrows to be examined. The slow query log can be used to find queries that take a long time to execute and are therefore candidates for optimization. - Audit log: Contains client connection and disconnect details, and what actions they perform while connected, such as which databases and tables they access.
- General log: A general record of what mysqld is doing. The server writes information to this log when clients connect or disconnect, and logs each SQL statement received from clients.
Viewing MySQL Logs in OCI Log Analytics
You can view the configured MySQL Logs in the OCI Log Analytics Log Explorer.
Viewing MySQL Telemetry and OCI Log Analytics Table
MySQL Telemetry and OCI Log Analytics table stores monitoring data for exported logs in MySQL Server's Performance Schema.
Using a Command-Line Client
Use a command-line client such as MySQL Client or MySQL Shell to view the MySQL Telemetry and OCI Log Analytics table.
- A command-line client such as MySQL Shell that is connected to the DB system. See Connecting to a DB System.
+--------------+---------------+----------------------+--------------------+------------------------+----------------------+-----------------+--------------------+-----------------------+
| CHANNEL_NAME | SERVICE_STATE | EXPORT_SUCCESS_COUNT | EXPORT_ERROR_COUNT | LAST_SUCCESS_TIMESTAMP | LAST_ERROR_TIMESTAMP | LAST_ERROR_CODE | LAST_ERROR_MESSAGE | LAST_ERROR_REQUEST_ID |
+--------------+---------------+----------------------+--------------------+------------------------+----------------------+-----------------+--------------------+-----------------------+
| ERROR_LOG | OFF | 0 | 0 | NULL | NULL | NULL | NULL | NULL |
| GENERAL_LOG | OFF | 0 | 0 | NULL | NULL | NULL | NULL | NULL |
| SLOW_LOG | OFF | 0 | 0 | NULL | NULL | NULL | NULL | NULL |
+--------------+---------------+----------------------+--------------------+------------------------+----------------------+-----------------+--------------------+-----------------------+ MySQL Telemetry and OCI Log Analytics Table
Performance Schema includes the following MySQL Telemetry and OCI Log Analytics table:
performance_schema.telemetry_oci_export_status Table
Table 17-14 telemetry_oci_export_status Performance Schema Table
| Column | Description |
|---|---|
CHANNEL_NAME
|
Indicates which log types were sent to OCI Log Analytics.
Valid values are: |
SERVICE_STATE
|
Indicates whether data is collected for each log type. |
EXPORT_SUCCESS_COUNT
|
Indicates the number of successful exports. |
EXPORT_ERROR_COUNT
|
Indicates the number of failed exports. |
LAST_SUCCESS_TIMESTAMP
|
Timestamp of the last successful export. |
LAST_ERROR_TIMESTAMP
|
Timestamp of the last failed export. |
LAST_ERROR_CODE
|
Error code of the last failed export. |
LAST_ERROR_MESSAGE
|
Error message of the last failed export. |
LAST_ERROR_REQUEST_ID
|
Request ID of the OCI Log Analytics REST API call for the last failed export, if any. |
Viewing MySQL Telemetry and OCI Log Analytics Status Variables
MySQL Telemetry and OCI Log Analytics status variables are static indicators that let you monitor the status of different MySQL Telemetry and OCI Log Analytics components. You cannot change the values of these variables.
Using a Command-Line Client
Use a command-line client such as MySQL Client or MySQL Shell to view the status variables and their values.
- A running DB system.
- A command-line client such as MySQL Client or MySQL Shell that is connected to the DB system. See Connecting to a DB System.
+-------------------------+-----------+
| Variable_name | Value |
+-------------------------+-----------+
| telemetry_oci.run_level | CONFIGURE |
+-------------------------+-----------+MySQL Telemetry and OCI Log Analytics Status Variables
Table 17-15 MySQL Telemetry and OCI Log Analytics Status Variables
| System Variable | Description | Possible Values |
|---|---|---|
log_offload.log_analytics_last_error_code |
Error code of the last failed export. | A string value. |
log_offload.log_analytics_last_error_message |
Error message of the last failed export. | A string value. |
log_offload.log_analytics_last_error_opc_request_id |
Request ID of the OCI Log Analytics REST API call for the last failed export. | A string value, similar to the following example:
/C8DBC62DADE6ECAC222ABF9CAABBC11C/13B10A00F071D7C39DAE333C3CB0DCD8 |
log_offload.log_analytics_last_error_timestamp |
Timestamp of the last failed export. | A string value, indicating the local time with 6
microsecond decimals similar to the following example:
2025-01-29 04:46:44.009907.
|
log_offload.log_analytics_ops_skipped
|
Indicates the number of files that were skipped from exporting. | An integer value. |
telemetry_oci.exports_failed_error_log |
Indicates the number of failed exports for the error log. | An integer value. |
telemetry_oci.exports_failed_general_log |
Indicates the number of failed exports for the general log. | An integer value. |
telemetry_oci.exports_failed_slow_log |
Indicates the number of failed exports for the general log. | An integer value. |
telemetry_oci.exports_success_error_log |
Indicates the number of successful exports for the error log. | An integer value. |
telemetry_oci.exports_success_general_log |
Indicates the number of successful exports for the general log. | An integer value. |
telemetry_oci.exports_success_slow_log |
Indicates the number of successful exports for the slow log. | An integer value. |
telemetry_oci.run_level |
Indicates the component state. |
|