•The plugin must be installed on each MySQL server that is used to execute SQL on the cluster. 

•Audit plugin data must be aggregated amongst all MySQL servers used with the cluster. This aggregation is the responsibility of the application or user. 

## 6.4.6 The Audit Message Component 

As of MySQL 8.0.14, the audit_api_message_emit  component enables applications to add their own message events to the audit log, using the audit_api_message_emit_udf()  function. 

The audit_api_message_emit  component cooperates with all plugins of audit type. For concreteness, examples use the audit_log  plugin described in Section 6.4.5, “MySQL Enterprise Audit” . 

## Installing or Uninstalling the Audit Message Component 

•Installing or Uninstalling the Audit Message Component 

•Audit Message Function 

To be usable by the server, the component library file must be located in the MySQL plugin directory (the directory named by the plugin_dir  system variable). If necessary, configure the plugin directory location by setting the value of plugin_dir  at server startup. 

To install the audit_api_message_emit  component, use this statement: 

INSTALL COMPONENT "file://component_audit_api_message_emit"; 

Component installation is a one-time operation that need not be done per server startup. INSTALL COMPONENT  loads the component, and also registers it in the mysql.component  system table to cause it to be loaded during subsequent server startups. 

To uninstall the audit_api_message_emit  component, use this statement: 

UNINSTALL COMPONENT "file://component_audit_api_message_emit"; 

UNINSTALL COMPONENT  unloads the component, and unregisters it from the mysql.component  system table to cause it not to be loaded during subsequent server startups. 

Because installing and uninstalling the audit_api_message_emit  component installs and uninstalls the audit_api_message_emit_udf()  function that the component implements, it is not necessary to use CREATE FUNCTION  or DROP FUNCTION  to do so. 

## Audit Message Function 

This section describes the audit_api_message_emit_udf()  function implemented by the audit_api_message_emit  component. 

Before using the audit message function, install the audit message component according to the instructions provided at Installing or Uninstalling the Audit Message Component. 

• audit_api_message_emit_udf( component , producer , message [, key , value ] ...) 

Adds a message event to the audit log. Message events include component, producer, and message strings of the caller’s choosing, and optionally a set of key-value pairs. 

An event posted by this function is sent to all enabled plugins of audit type, each of which handles the event according to its own rules. If no plugin of audit type is enabled, posting the event has no effect. 

Arguments: 

