databaseActivityEventList JSON array for database activity streams - Amazon Aurora

databaseActivityEventList JSON array for database activity streams

The audit log payload is an encrypted databaseActivityEventList JSON array. The following tables lists alphabetically the fields for each activity event in the decrypted DatabaseActivityEventList array of an audit log. The fields differ depending on whether you use Aurora PostgreSQL or Aurora MySQL. Consult the table that applies to your database engine.

Important

The event structure is subject to change. Aurora might add new fields to activity events in the future. In applications that parse the JSON data, make sure that your code can ignore or take appropriate actions for unknown field names.

databaseActivityEventList fields for Aurora PostgreSQL

The following are databaseActivityEventList fields for Aurora PostgreSQL.

Field Data Type Description
class string

The class of activity event. Valid values for Aurora PostgreSQL are the following:

  • ALL

  • CONNECT – A connect or disconnect event.

  • DDL – A DDL statement that is not included in the list of statements for the ROLE class.

  • FUNCTION – A function call or a DO block.

  • MISC – A miscellaneous command such as DISCARD, FETCH, CHECKPOINT, or VACUUM.

  • NONE

  • READ – A SELECT or COPY statement when the source is a relation or a query.

  • ROLE – A statement related to roles and privileges including GRANT, REVOKE, and CREATE/ALTER/DROP ROLE.

  • WRITE – An INSERT, UPDATE, DELETE, TRUNCATE, or COPY statement when the destination is a relation.

clientApplication string The application the client used to connect as reported by the client. The client doesn't have to provide this information, so the value can be null.
command string The name of the SQL command without any command details.
commandText string

The actual SQL statement passed in by the user. For Aurora PostgreSQL, the value is identical to the original SQL statement. This field is used for all types of records except for connect or disconnect records, in which case the value is null.

Important

The full SQL text of each statement is visible in the activity stream audit log, including any sensitive data. However, database user passwords are redacted if Aurora can determine them from the context, such as in the following SQL statement.

ALTER ROLE role-name WITH password
databaseName string The database to which the user connected.
dbProtocol string The database protocol, for example Postgres 3.0.
dbUserName string The database user with which the client authenticated.
errorMessage

(version 1.1 database activity records only)

string

If there was any error, this field is populated with the error message that would've been generated by the DB server. The errorMessage value is null for normal statements that didn't result in an error.

An error is defined as any activity that would produce a client-visible PostgreSQL error log event at a severity level of ERROR or greater. For more information, see PostgreSQL Message Severity Levels. For example, syntax errors and query cancellations generate an error message.

Internal PostgreSQL server errors such as background checkpointer process errors do not generate an error message. However, records for such events are still emitted regardless of the setting of the log severity level. This prevents attackers from turning off logging to attempt avoiding detection.

See also the exitCode field.

exitCode int A value used for a session exit record. On a clean exit, this contains the exit code. An exit code can't always be obtained in some failure scenarios. Examples are if PostgreSQL does an exit() or if an operator performs a command such as kill -9.

If there was any error, the exitCode field shows the SQL error code, SQLSTATE, as listed in PostgreSQL Error Codes.

See also the errorMessage field.

logTime string A timestamp as recorded in the auditing code path. This represents the SQL statement execution end time. See also the startTime field.
netProtocol string The network communication protocol.
objectName string The name of the database object if the SQL statement is operating on one. This field is used only where the SQL statement operates on a database object. If the SQL statement is not operating on an object, this value is null.
objectType string The database object type such as table, index, view, and so on. This field is used only where the SQL statement operates on a database object. If the SQL statement is not operating on an object, this value is null. Valid values include the following:
  • COMPOSITE TYPE

  • FOREIGN TABLE

  • FUNCTION

  • INDEX

  • MATERIALIZED VIEW

  • SEQUENCE

  • TABLE

  • TOAST TABLE

  • VIEW

  • UNKNOWN

paramList string An array of comma-separated parameters passed to the SQL statement. If the SQL statement has no parameters, this value is an empty array.
pid int The process ID of the backend process that is allocated for serving the client connection.
remoteHost string Either the client IP address or hostname. For Aurora PostgreSQL, which one is used depends on the database's log_hostname parameter setting. The remoteHost value also includes [local] and localhost which indicate activity from the rdsadmin user.
remotePort string The client port number.
rowCount int The number of rows returned by the SQL statement. For example, if a SELECT statement returns 10 rows, rowCount is 10. For INSERT or UPDATE statements, rowCount is 0.
serverHost string The database server host IP address. The serverHost value also includes [local] and localhost which indicate activity from the rdsadmin user.
serverType string The database server type, for example PostgreSQL.
serverVersion string The database server version, for example 2.3.1 for Aurora PostgreSQL.
serviceName string The name of the service, for example Amazon Aurora PostgreSQL-Compatible edition.
sessionId int A pseudo-unique session identifier.
sessionId int A pseudo-unique session identifier.
startTime

(version 1.1 database activity records only)

string

The time when execution began for the SQL statement.

To calculate the approximate execution time of the SQL statement, use logTime - startTime. See also the logTime field.

statementId int An identifier for the client's SQL statement. The counter is at the session level and increments with each SQL statement entered by the client.
substatementId int An identifier for a SQL substatement. This value counts the contained substatements for each SQL statement identified by the statementId field.
type string The event type. Valid values are record or heartbeat.

databaseActivityEventList fields for Aurora MySQL

The following are databaseActivityEventList fields for Aurora MySQL.

Field Data Type Description
class string

The class of activity event.

Valid values for Aurora MySQL are the following:

  • MAIN – The primary event representing a SQL statement.

  • AUX – A supplemental event containing additional details. For example, a statement that renames an object might have an event with class AUX that reflects the new name.

    To find MAIN and AUX events corresponding to the same statement, check for different events that have the same values for the pid field and for the statementId field.

clientApplication string The application the client used to connect as reported by the client. The client doesn't have to provide this information, so the value can be null.
command string

The general category of the SQL statement. The values for this field depend on the value of class.

The values when class is MAIN include the following:

  • CONNECT – When a client session is connected.

  • QUERY – A SQL statement. Accompanied by one or more events with a class value of AUX.

  • DISCONNECT – When a client session is disconnected.

  • FAILED_CONNECT – When a client attempts to connect but isn't able to.

  • CHANGEUSER – A state change that's part of the MySQL network protocol, not from a statement that you issue.

The values when class is AUX include the following:

  • READ – A SELECT or COPY statement when the source is a relation or a query.

  • WRITE – An INSERT, UPDATE, DELETE, TRUNCATE, or COPY statement when the destination is a relation.

  • DROP – Deleting an object.

  • CREATE – Creating an object.

  • RENAME – Renaming an object.

  • ALTER – Changing the properties of an object.

commandText string

For events with a class value of MAIN, this field represents the actual SQL statement passed in by the user. This field is used for all types of records except for connect or disconnect records, in which case the value is null.

For events with a class value of AUX, this field contains supplemental information about the objects involved in the event.

For Aurora MySQL, characters such as quotation marks are preceded by a backslash, representing an escape character.

Important

The full SQL text of each statement is visible in the audit log, including any sensitive data. However, database user passwords are redacted if Aurora can determine them from the context, such as in the following SQL statement.

mysql> SET PASSWORD = 'my-password';
Note

Specify a password other than the prompt shown here as a security best practice.

databaseName string The database to which the user connected.
dbProtocol string The database protocol. Currently, this value is always MySQL for Aurora MySQL.
dbUserName string The database user with which the client authenticated.
endTime

(version 1.2 database activity records only)

string

The time when execution ended for the SQL statement. It is represented in Coordinated Universal Time (UTC) format.

To calculate the execution time of the SQL statement, use endTime - startTime. See also the startTime field.

errorMessage

(version 1.1 database activity records only)

string

If there was any error, this field is populated with the error message that would've been generated by the DB server. The errorMessage value is null for normal statements that didn't result in an error.

An error is defined as any activity that would produce a client-visible MySQL error log event at a severity level of ERROR or greater. For more information, see The Error Log in the MySQL Reference Manual. For example, syntax errors and query cancellations generate an error message.

Internal MySQL server errors such as background checkpointer process errors do not generate an error message. However, records for such events are still emitted regardless of the setting of the log severity level. This prevents attackers from turning off logging to attempt avoiding detection.

See also the exitCode field.

exitCode int A value used for a session exit record. On a clean exit, this contains the exit code. An exit code can't always be obtained in some failure scenarios. In such cases, this value might be zero or might be blank.
logTime string A timestamp as recorded in the auditing code path. It is represented in Coordinated Universal Time (UTC) format. For the most accurate way to calculate statement duration, see the startTime and endTime fields.
netProtocol string The network communication protocol. Currently, this value is always TCP for Aurora MySQL.
objectName string The name of the database object if the SQL statement is operating on one. This field is used only where the SQL statement operates on a database object. If the SQL statement isn't operating on an object, this value is blank. To construct the fully qualified name of the object, combine databaseName and objectName. If the query involves multiple objects, this field can be a comma-separated list of names.
objectType string

The database object type such as table, index, and so on. This field is used only where the SQL statement operates on a database object. If the SQL statement is not operating on an object, this value is null.

Valid values for Aurora MySQL include the following:

  • INDEX

  • TABLE

  • UNKNOWN

paramList string This field isn't used for Aurora MySQL and is always null.
pid int The process ID of the backend process that is allocated for serving the client connection. When the database server is restarted, the pid changes and the counter for the statementId field starts over.
remoteHost string Either the IP address or hostname of the client that issued the SQL statement. For Aurora MySQL, which one is used depends on the database's skip_name_resolve parameter setting. The value localhost indicates activity from the rdsadmin special user.
remotePort string The client port number.
rowCount int The number of table rows affected or retrieved by the SQL statement. This field is used only for SQL statements that are data manipulation language (DML) statements. If the SQL statement is not a DML statement, this value is null.
serverHost string The database server instance identifier.
serverType string The database server type, for example MySQL.
serverVersion string The database server version. Currently, this value is always MySQL 5.7.12 for Aurora MySQL.
serviceName string The name of the service. Currently, this value is always Amazon Aurora MySQL for Aurora MySQL.
sessionId int A pseudo-unique session identifier.
startTime

(version 1.1 database activity records only)

string

The time when execution began for the SQL statement. It is represented in Coordinated Universal Time (UTC) format.

To calculate the execution time of the SQL statement, use endTime - startTime. See also the endTime field.

statementId int An identifier for the client's SQL statement. The counter increments with each SQL statement entered by the client. The counter is reset when the DB instance is restarted.
substatementId int An identifier for a SQL substatement. This value is 1 for events with class MAIN and 2 for events with class AUX. Use the statementId field to identify all the events generated by the same statement.
transactionId

(version 1.2 database activity records only)

int An identifier for a transaction.
type string The event type. Valid values are record or heartbeat.