MySQL 8.0.40
Source Code Documentation
plugin_audit.h File Reference

Go to the source code of this file.

Classes

struct  st_mysql_audit
 The descriptor structure that is referred from st_mysql_plugin. More...
 
struct  mysql_event_general
 Structure for the MYSQL_AUDIT_GENERAL_CLASS event class. More...
 
struct  mysql_event_connection
 Structure for the MYSQL_AUDIT_CONNECTION_CLASS event class. More...
 
struct  mysql_event_parse
 Data for the MYSQL_AUDIT_PARSE events. More...
 
struct  mysql_event_authorization
 Structure for MYSQL_AUDIT_AUTHORIZATION_CLASS event class. More...
 
struct  mysql_event_table_access
 
struct  mysql_event_global_variable
 Events for MYSQL_AUDIT_GLOBAL_VARIABLE_CLASS event class. More...
 
struct  mysql_event_server_startup
 Structure for MYSQL_AUDIT_SERVER_STARTUP_CLASS event class. More...
 
struct  mysql_event_server_shutdown
 Structure for MYSQL_AUDIT_SERVER_SHUTDOWN_CLASS event class. More...
 
struct  mysql_event_command
 Event for MYSQL_AUDIT_COMMAND_CLASS event class. More...
 
struct  mysql_event_query
 
struct  mysql_event_stored_program
 
struct  mysql_event_authentication
 Structure for MYSQL_AUDIT_AUTHENTICATION_CLASS event class. More...
 
struct  mysql_event_message
 Structure for MYSQL_AUDIT_MESSAGE_CLASS event class. More...
 

Macros

#define MYSQL_AUDIT_INTERFACE_VERSION   0x0401
 
#define MYSQL_AUDIT_GENERAL_ALL
 
#define MYSQL_AUDIT_CONNECTION_ALL
 
#define MYSQL_AUDIT_PARSE_ALL    (MYSQL_AUDIT_PARSE_PREPARSE | MYSQL_AUDIT_PARSE_POSTPARSE)
 
#define MYSQL_AUDIT_AUTHORIZATION_ALL
 
#define MYSQL_AUDIT_TABLE_ACCESS_ALL
 
#define MYSQL_AUDIT_GLOBAL_VARIABLE_ALL    (MYSQL_AUDIT_GLOBAL_VARIABLE_GET | MYSQL_AUDIT_GLOBAL_VARIABLE_SET)
 
#define MYSQL_AUDIT_SERVER_STARTUP_ALL   (MYSQL_AUDIT_SERVER_STARTUP_STARTUP)
 
#define MYSQL_AUDIT_SERVER_SHUTDOWN_ALL   (MYSQL_AUDIT_SERVER_SHUTDOWN_SHUTDOWN)
 
#define MYSQL_AUDIT_COMMAND_ALL    (MYSQL_AUDIT_COMMAND_START | MYSQL_AUDIT_COMMAND_END)
 
#define MYSQL_AUDIT_QUERY_ALL
 
#define MYSQL_AUDIT_STORED_PROGRAM_ALL   (MYSQL_AUDIT_STORED_PROGRAM_EXECUTE)
 
#define MYSQL_AUDIT_AUTHENTICATION_ALL
 
#define MYSQL_AUDIT_MESSAGE_ALL    (MYSQL_AUDIT_MESSAGE_INTERNAL | MYSQL_AUDIT_MESSAGE_USER)
 

Typedefs

typedef enum enum_sql_command enum_sql_command_t
 SQL command type definition. More...
 
typedef enum mysql_event_table_access_subclass_t mysql_event_table_access_subclass_t
 
typedef enum enum_server_command enum_server_command_t
 Server command type definition. More...
 

Enumerations

enum  mysql_event_class_t {
  MYSQL_AUDIT_GENERAL_CLASS = 0 , MYSQL_AUDIT_CONNECTION_CLASS = 1 , MYSQL_AUDIT_PARSE_CLASS = 2 , MYSQL_AUDIT_AUTHORIZATION_CLASS = 3 ,
  MYSQL_AUDIT_TABLE_ACCESS_CLASS = 4 , MYSQL_AUDIT_GLOBAL_VARIABLE_CLASS = 5 , MYSQL_AUDIT_SERVER_STARTUP_CLASS = 6 , MYSQL_AUDIT_SERVER_SHUTDOWN_CLASS = 7 ,
  MYSQL_AUDIT_COMMAND_CLASS = 8 , MYSQL_AUDIT_QUERY_CLASS = 9 , MYSQL_AUDIT_STORED_PROGRAM_CLASS = 10 , MYSQL_AUDIT_AUTHENTICATION_CLASS = 11 ,
  MYSQL_AUDIT_MESSAGE_CLASS = 12 , MYSQL_AUDIT_CLASS_MASK_SIZE
}
 Audit event classes. More...
 
enum  mysql_event_general_subclass_t { MYSQL_AUDIT_GENERAL_LOG = 1 << 0 , MYSQL_AUDIT_GENERAL_ERROR = 1 << 1 , MYSQL_AUDIT_GENERAL_RESULT = 1 << 2 , MYSQL_AUDIT_GENERAL_STATUS = 1 << 3 }
 Events for the MYSQL_AUDIT_GENERAL_CLASS event class. More...
 
enum  mysql_event_parse_subclass_t { MYSQL_AUDIT_PARSE_PREPARSE = 1 << 0 , MYSQL_AUDIT_PARSE_POSTPARSE = 1 << 1 }
 Events for MYSQL_AUDIT_PARSE_CLASS event class. More...
 
enum  mysql_event_parse_rewrite_plugin_flag { MYSQL_AUDIT_PARSE_REWRITE_PLUGIN_NONE = 0 , MYSQL_AUDIT_PARSE_REWRITE_PLUGIN_QUERY_REWRITTEN = 1 << 0 , MYSQL_AUDIT_PARSE_REWRITE_PLUGIN_IS_PREPARED_STATEMENT = 1 << 1 }
 
enum  mysql_event_authorization_subclass_t {
  MYSQL_AUDIT_AUTHORIZATION_USER = 1 << 0 , MYSQL_AUDIT_AUTHORIZATION_DB = 1 << 1 , MYSQL_AUDIT_AUTHORIZATION_TABLE = 1 << 2 , MYSQL_AUDIT_AUTHORIZATION_COLUMN = 1 << 3 ,
  MYSQL_AUDIT_AUTHORIZATION_PROCEDURE = 1 << 4 , MYSQL_AUDIT_AUTHORIZATION_PROXY = 1 << 5
}
 Events for MYSQL_AUDIT_AUTHORIZATION_CLASS event class. More...
 
enum  mysql_event_table_access_subclass_t { MYSQL_AUDIT_TABLE_ACCESS_READ = 1 << 0 , MYSQL_AUDIT_TABLE_ACCESS_INSERT = 1 << 1 , MYSQL_AUDIT_TABLE_ACCESS_UPDATE = 1 << 2 , MYSQL_AUDIT_TABLE_ACCESS_DELETE = 1 << 3 }
 Events for MYSQL_AUDIT_TABLE_ACCESS_CLASS event class. More...
 
enum  mysql_event_global_variable_subclass_t { MYSQL_AUDIT_GLOBAL_VARIABLE_GET = 1 << 0 , MYSQL_AUDIT_GLOBAL_VARIABLE_SET = 1 << 1 }
 Events for MYSQL_AUDIT_GLOBAL_VARIABLE_CLASS event class. More...
 
enum  mysql_event_server_startup_subclass_t { MYSQL_AUDIT_SERVER_STARTUP_STARTUP = 1 << 0 }
 Events for MYSQL_AUDIT_SERVER_STARTUP_CLASS event class. More...
 
enum  mysql_event_server_shutdown_subclass_t { MYSQL_AUDIT_SERVER_SHUTDOWN_SHUTDOWN = 1 << 0 }
 Events for MYSQL_AUDIT_SERVER_SHUTDOWN_CLASS event class. More...
 
enum  mysql_server_shutdown_reason_t { MYSQL_AUDIT_SERVER_SHUTDOWN_REASON_SHUTDOWN , MYSQL_AUDIT_SERVER_SHUTDOWN_REASON_ABORT }
 Server shutdown reason. More...
 
enum  mysql_event_command_subclass_t { MYSQL_AUDIT_COMMAND_START = 1 << 0 , MYSQL_AUDIT_COMMAND_END = 1 << 1 }
 Events for MYSQL_AUDIT_COMMAND_CLASS event class. More...
 
enum  mysql_event_query_subclass_t { MYSQL_AUDIT_QUERY_START = 1 << 0 , MYSQL_AUDIT_QUERY_NESTED_START = 1 << 1 , MYSQL_AUDIT_QUERY_STATUS_END = 1 << 2 , MYSQL_AUDIT_QUERY_NESTED_STATUS_END = 1 << 3 }
 Events for MYSQL_AUDIT_QUERY_CLASS event class. More...
 
enum  mysql_event_stored_program_subclass_t { MYSQL_AUDIT_STORED_PROGRAM_EXECUTE = 1 << 0 }
 Events for MYSQL_AUDIT_STORED_PROGRAM_CLASS event class. More...
 
enum  mysql_event_authentication_subclass_t {
  MYSQL_AUDIT_AUTHENTICATION_FLUSH = 1 << 0 , MYSQL_AUDIT_AUTHENTICATION_AUTHID_CREATE = 1 << 1 , MYSQL_AUDIT_AUTHENTICATION_CREDENTIAL_CHANGE = 1 << 2 , MYSQL_AUDIT_AUTHENTICATION_AUTHID_RENAME = 1 << 3 ,
  MYSQL_AUDIT_AUTHENTICATION_AUTHID_DROP = 1 << 4
}
 Events for MYSQL_AUDIT_AUTHENTICATION_CLASS event class. More...
 

Macro Definition Documentation

◆ MYSQL_AUDIT_AUTHENTICATION_ALL

#define MYSQL_AUDIT_AUTHENTICATION_ALL
Value:
MYSQL_AUDIT_AUTHENTICATION_AUTHID_CREATE | \
MYSQL_AUDIT_AUTHENTICATION_CREDENTIAL_CHANGE | \
MYSQL_AUDIT_AUTHENTICATION_AUTHID_RENAME | \
MYSQL_AUDIT_AUTHENTICATION_AUTHID_DROP)
@ MYSQL_AUDIT_AUTHENTICATION_FLUSH
Generated after FLUSH PRIVILEGES.
Definition: plugin_audit.h:541

◆ MYSQL_AUDIT_AUTHORIZATION_ALL

#define MYSQL_AUDIT_AUTHORIZATION_ALL
Value:
MYSQL_AUDIT_AUTHORIZATION_TABLE | MYSQL_AUDIT_AUTHORIZATION_COLUMN | \
MYSQL_AUDIT_AUTHORIZATION_PROCEDURE | MYSQL_AUDIT_AUTHORIZATION_PROXY)
@ MYSQL_AUDIT_AUTHORIZATION_PROXY
Occurs when proxy privilege is checked.
Definition: plugin_audit.h:245
@ MYSQL_AUDIT_AUTHORIZATION_COLUMN
Occurs when column privilege is checked.
Definition: plugin_audit.h:241
@ MYSQL_AUDIT_AUTHORIZATION_USER
Definition: plugin_audit.h:235
@ MYSQL_AUDIT_AUTHORIZATION_DB
Occurs when database privilege is checked.
Definition: plugin_audit.h:237

◆ MYSQL_AUDIT_COMMAND_ALL

#define MYSQL_AUDIT_COMMAND_ALL    (MYSQL_AUDIT_COMMAND_START | MYSQL_AUDIT_COMMAND_END)

◆ MYSQL_AUDIT_CONNECTION_ALL

#define MYSQL_AUDIT_CONNECTION_ALL
Value:
MYSQL_AUDIT_CONNECTION_CHANGE_USER | \
MYSQL_AUDIT_CONNECTION_PRE_AUTHENTICATE)
@ MYSQL_AUDIT_CONNECTION_CONNECT
occurs after authentication phase is completed.
Definition: plugin_audit_connection_types.h:39
@ MYSQL_AUDIT_CONNECTION_DISCONNECT
occurs after connection is terminated.
Definition: plugin_audit_connection_types.h:41

◆ MYSQL_AUDIT_GENERAL_ALL

#define MYSQL_AUDIT_GENERAL_ALL
Value:
MYSQL_AUDIT_GENERAL_RESULT | MYSQL_AUDIT_GENERAL_STATUS)
@ MYSQL_AUDIT_GENERAL_ERROR
occurs before transmitting errors to the user.
Definition: plugin_audit.h:116
@ MYSQL_AUDIT_GENERAL_STATUS
occurs after transmitting a resultset or errors
Definition: plugin_audit.h:120
@ MYSQL_AUDIT_GENERAL_LOG
occurs before emitting to the general query log.
Definition: plugin_audit.h:114

◆ MYSQL_AUDIT_GLOBAL_VARIABLE_ALL

#define MYSQL_AUDIT_GLOBAL_VARIABLE_ALL    (MYSQL_AUDIT_GLOBAL_VARIABLE_GET | MYSQL_AUDIT_GLOBAL_VARIABLE_SET)

◆ MYSQL_AUDIT_INTERFACE_VERSION

#define MYSQL_AUDIT_INTERFACE_VERSION   0x0401

◆ MYSQL_AUDIT_MESSAGE_ALL

#define MYSQL_AUDIT_MESSAGE_ALL    (MYSQL_AUDIT_MESSAGE_INTERNAL | MYSQL_AUDIT_MESSAGE_USER)

◆ MYSQL_AUDIT_PARSE_ALL

#define MYSQL_AUDIT_PARSE_ALL    (MYSQL_AUDIT_PARSE_PREPARSE | MYSQL_AUDIT_PARSE_POSTPARSE)

◆ MYSQL_AUDIT_QUERY_ALL

#define MYSQL_AUDIT_QUERY_ALL
Value:
MYSQL_AUDIT_QUERY_STATUS_END | MYSQL_AUDIT_QUERY_NESTED_STATUS_END)
@ MYSQL_AUDIT_QUERY_START
Query start event.
Definition: plugin_audit.h:463
@ MYSQL_AUDIT_QUERY_NESTED_STATUS_END
Nested query status end event.
Definition: plugin_audit.h:469
@ MYSQL_AUDIT_QUERY_NESTED_START
Nested query start event.
Definition: plugin_audit.h:465

◆ MYSQL_AUDIT_SERVER_SHUTDOWN_ALL

#define MYSQL_AUDIT_SERVER_SHUTDOWN_ALL   (MYSQL_AUDIT_SERVER_SHUTDOWN_SHUTDOWN)

◆ MYSQL_AUDIT_SERVER_STARTUP_ALL

#define MYSQL_AUDIT_SERVER_STARTUP_ALL   (MYSQL_AUDIT_SERVER_STARTUP_STARTUP)

◆ MYSQL_AUDIT_STORED_PROGRAM_ALL

#define MYSQL_AUDIT_STORED_PROGRAM_ALL   (MYSQL_AUDIT_STORED_PROGRAM_EXECUTE)

◆ MYSQL_AUDIT_TABLE_ACCESS_ALL

#define MYSQL_AUDIT_TABLE_ACCESS_ALL
Value:
MYSQL_AUDIT_TABLE_ACCESS_UPDATE | MYSQL_AUDIT_TABLE_ACCESS_DELETE)
@ MYSQL_AUDIT_TABLE_ACCESS_READ
Occurs when table data are read.
Definition: plugin_audit.h:287
@ MYSQL_AUDIT_TABLE_ACCESS_DELETE
Occurs when table data are deleted.
Definition: plugin_audit.h:293
@ MYSQL_AUDIT_TABLE_ACCESS_INSERT
Occurs when table data are inserted.
Definition: plugin_audit.h:289

Typedef Documentation

◆ enum_server_command_t

Server command type definition.

◆ enum_sql_command_t

SQL command type definition.

◆ mysql_event_table_access_subclass_t

Enumeration Type Documentation

◆ mysql_event_authentication_subclass_t

Events for MYSQL_AUDIT_AUTHENTICATION_CLASS event class.

Event handler can not terminate an event unless stated explicitly.

Enumerator
MYSQL_AUDIT_AUTHENTICATION_FLUSH 

Generated after FLUSH PRIVILEGES.

MYSQL_AUDIT_AUTHENTICATION_AUTHID_CREATE 

Generated after CREATE USER | CREATE ROLE.

MYSQL_AUDIT_AUTHENTICATION_CREDENTIAL_CHANGE 

Generated after credential change through:

  • SET PASSWORD
  • ALTER USER
  • GRANT
MYSQL_AUDIT_AUTHENTICATION_AUTHID_RENAME 

Generated after RENAME USER.

MYSQL_AUDIT_AUTHENTICATION_AUTHID_DROP 

Generated after DROP USER.

◆ mysql_event_authorization_subclass_t

Events for MYSQL_AUDIT_AUTHORIZATION_CLASS event class.

Enumerator
MYSQL_AUDIT_AUTHORIZATION_USER 
MYSQL_AUDIT_AUTHORIZATION_DB 

Occurs when database privilege is checked.

MYSQL_AUDIT_AUTHORIZATION_TABLE 

Occurs when table privilege is checked.

MYSQL_AUDIT_AUTHORIZATION_COLUMN 

Occurs when column privilege is checked.

MYSQL_AUDIT_AUTHORIZATION_PROCEDURE 

Occurs when procedure privilege is checked.

MYSQL_AUDIT_AUTHORIZATION_PROXY 

Occurs when proxy privilege is checked.

◆ mysql_event_class_t

Audit event classes.

Enumerator
MYSQL_AUDIT_GENERAL_CLASS 
MYSQL_AUDIT_CONNECTION_CLASS 
MYSQL_AUDIT_PARSE_CLASS 
MYSQL_AUDIT_AUTHORIZATION_CLASS 
MYSQL_AUDIT_TABLE_ACCESS_CLASS 
MYSQL_AUDIT_GLOBAL_VARIABLE_CLASS 
MYSQL_AUDIT_SERVER_STARTUP_CLASS 
MYSQL_AUDIT_SERVER_SHUTDOWN_CLASS 
MYSQL_AUDIT_COMMAND_CLASS 
MYSQL_AUDIT_QUERY_CLASS 
MYSQL_AUDIT_STORED_PROGRAM_CLASS 
MYSQL_AUDIT_AUTHENTICATION_CLASS 
MYSQL_AUDIT_MESSAGE_CLASS 
MYSQL_AUDIT_CLASS_MASK_SIZE 

◆ mysql_event_command_subclass_t

Events for MYSQL_AUDIT_COMMAND_CLASS event class.

Enumerator
MYSQL_AUDIT_COMMAND_START 

Command start event.

MYSQL_AUDIT_COMMAND_END 

Command end event.

◆ mysql_event_general_subclass_t

Events for the MYSQL_AUDIT_GENERAL_CLASS event class.

Enumerator
MYSQL_AUDIT_GENERAL_LOG 

occurs before emitting to the general query log.

MYSQL_AUDIT_GENERAL_ERROR 

occurs before transmitting errors to the user.

MYSQL_AUDIT_GENERAL_RESULT 

occurs after transmitting a resultset to the user.

MYSQL_AUDIT_GENERAL_STATUS 

occurs after transmitting a resultset or errors

◆ mysql_event_global_variable_subclass_t

Events for MYSQL_AUDIT_GLOBAL_VARIABLE_CLASS event class.

Enumerator
MYSQL_AUDIT_GLOBAL_VARIABLE_GET 

Occurs when global variable is retrieved.

MYSQL_AUDIT_GLOBAL_VARIABLE_SET 

Occurs when global variable is set.

◆ mysql_event_parse_rewrite_plugin_flag

Enumerator
MYSQL_AUDIT_PARSE_REWRITE_PLUGIN_NONE 
MYSQL_AUDIT_PARSE_REWRITE_PLUGIN_QUERY_REWRITTEN 

mysql_event_parse::flags Must be set by a plugin if the query is rewritten.

MYSQL_AUDIT_PARSE_REWRITE_PLUGIN_IS_PREPARED_STATEMENT 

mysql_event_parse::flags Is set by the server if the query is prepared statement.

◆ mysql_event_parse_subclass_t

Events for MYSQL_AUDIT_PARSE_CLASS event class.

Enumerator
MYSQL_AUDIT_PARSE_PREPARSE 

occurs before the query parsing.

MYSQL_AUDIT_PARSE_POSTPARSE 

occurs after the query parsing.

◆ mysql_event_query_subclass_t

Events for MYSQL_AUDIT_QUERY_CLASS event class.

Enumerator
MYSQL_AUDIT_QUERY_START 

Query start event.

MYSQL_AUDIT_QUERY_NESTED_START 

Nested query start event.

MYSQL_AUDIT_QUERY_STATUS_END 

Query post parse event.

MYSQL_AUDIT_QUERY_NESTED_STATUS_END 

Nested query status end event.

◆ mysql_event_server_shutdown_subclass_t

Events for MYSQL_AUDIT_SERVER_SHUTDOWN_CLASS event class.

Enumerator
MYSQL_AUDIT_SERVER_SHUTDOWN_SHUTDOWN 

Occurs when global variable is set.

◆ mysql_event_server_startup_subclass_t

Events for MYSQL_AUDIT_SERVER_STARTUP_CLASS event class.

Enumerator
MYSQL_AUDIT_SERVER_STARTUP_STARTUP 

Occurs after all subsystem are initialized during system start.

◆ mysql_event_stored_program_subclass_t

Events for MYSQL_AUDIT_STORED_PROGRAM_CLASS event class.

Enumerator
MYSQL_AUDIT_STORED_PROGRAM_EXECUTE 

Stored program execution event.

◆ mysql_event_table_access_subclass_t

Events for MYSQL_AUDIT_TABLE_ACCESS_CLASS event class.

Enumerator
MYSQL_AUDIT_TABLE_ACCESS_READ 

Occurs when table data are read.

MYSQL_AUDIT_TABLE_ACCESS_INSERT 

Occurs when table data are inserted.

MYSQL_AUDIT_TABLE_ACCESS_UPDATE 

Occurs when table data are updated.

MYSQL_AUDIT_TABLE_ACCESS_DELETE 

Occurs when table data are deleted.

◆ mysql_server_shutdown_reason_t

Server shutdown reason.

Enumerator
MYSQL_AUDIT_SERVER_SHUTDOWN_REASON_SHUTDOWN 

User requested shut down.

MYSQL_AUDIT_SERVER_SHUTDOWN_REASON_ABORT 

The server aborts.