diff --git a/docs/generated/eventlog.md b/docs/generated/eventlog.md index 5ed8e6725e9f..d17094c63600 100644 --- a/docs/generated/eventlog.md +++ b/docs/generated/eventlog.md @@ -227,6 +227,7 @@ An event of type `set_cluster_setting` is recorded when a cluster setting is cha | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -261,6 +262,7 @@ is directly or indirectly a member of the admin role) executes a query. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -294,6 +296,7 @@ a table marked as audited. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -334,6 +337,7 @@ and the cluster setting `sql.trace.log_statement_execute` is set. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -379,6 +383,7 @@ An event of type `alter_database_add_region` is recorded when a region is added | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -402,6 +407,7 @@ AlterDatabaseAddRegion is recorded when a region is added to a database. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -425,6 +431,7 @@ An event of type `alter_database_primary_region` is recorded when a primary regi | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -448,6 +455,7 @@ An event of type `alter_database_survival_goal` is recorded when the survival go | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -472,6 +480,7 @@ An event of type `alter_index` is recorded when an index is altered. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -494,6 +503,7 @@ An event of type `alter_sequence` is recorded when a sequence is altered. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -518,6 +528,7 @@ An event of type `alter_table` is recorded when a table is altered. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -540,6 +551,7 @@ EventAlterType is recorded when a user-defined type is altered. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -565,6 +577,7 @@ An event of type `comment_on_column` is recorded when a column is commented. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -589,6 +602,7 @@ CommentOnTable is recorded when a database is commented. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -614,6 +628,7 @@ An event of type `comment_on_index` is recorded when an index is commented. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -638,6 +653,7 @@ An event of type `comment_on_table` is recorded when a table is commented. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -661,6 +677,7 @@ An event of type `convert_to_schema` is recorded when a database is converted to | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -683,6 +700,7 @@ An event of type `create_database` is recorded when a database is created. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -707,6 +725,7 @@ An event of type `create_index` is recorded when an index is created. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -730,6 +749,7 @@ An event of type `create_schema` is recorded when a schema is created. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -753,6 +773,7 @@ An event of type `create_sequence` is recorded when a sequence is created. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -779,6 +800,7 @@ Events of this type are only collected when the cluster setting | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -802,6 +824,7 @@ An event of type `create_table` is recorded when a table is created. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -825,6 +848,7 @@ An event of type `create_type` is recorded when a user-defined type is created. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -849,6 +873,7 @@ An event of type `create_view` is recorded when a view is created. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -872,6 +897,7 @@ An event of type `drop_database` is recorded when a database is dropped. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -897,6 +923,7 @@ An event of type `drop_index` is recorded when an index is dropped. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -919,6 +946,7 @@ An event of type `drop_schema` is recorded when a schema is dropped. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -941,6 +969,7 @@ An event of type `drop_sequence` is recorded when a sequence is dropped. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -964,6 +993,7 @@ An event of type `drop_table` is recorded when a table is dropped. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -986,6 +1016,7 @@ An event of type `drop_type` is recorded when a user-defined type is dropped. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -1009,6 +1040,7 @@ An event of type `drop_view` is recorded when a view is dropped. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -1066,6 +1098,7 @@ initiated schema change rollback has completed. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -1089,6 +1122,7 @@ An event of type `rename_database` is recorded when a database is renamed. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -1112,6 +1146,7 @@ An event of type `rename_schema` is recorded when a schema is renamed. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -1135,6 +1170,7 @@ An event of type `rename_table` is recorded when a table, sequence or view is re | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -1158,6 +1194,7 @@ An event of type `rename_type` is recorded when a user-defined type is renamed. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -1204,6 +1241,7 @@ An event of type `set_schema` is recorded when a table, view, sequence or type's | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -1226,6 +1264,7 @@ An event of type `truncate_table` is recorded when a table is truncated. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -1256,6 +1295,7 @@ patch releases without advance notice. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -1286,6 +1326,7 @@ patch releases without advance notice. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -1312,6 +1353,7 @@ using crdb_internal.unsafe_upsert_descriptor(). | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -1344,6 +1386,7 @@ patch releases without advance notice. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -1380,6 +1423,7 @@ An event of type `alter_database_owner` is recorded when a database's owner is c | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -1403,6 +1447,7 @@ An event of type `alter_schema_owner` is recorded when a schema's owner is chang | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -1426,6 +1471,7 @@ An event of type `alter_table_owner` is recorded when the owner of a table, view | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -1449,6 +1495,7 @@ An event of type `alter_type_owner` is recorded when the owner of a user-defiend | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -1472,6 +1519,7 @@ added to / removed from a user for a database object. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -1498,6 +1546,7 @@ removed from a user for a schema object. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -1524,6 +1573,7 @@ from a user for a table, sequence or view object. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -1550,6 +1600,7 @@ removed from a user for a type object. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -1757,6 +1808,7 @@ set to a non-zero value, AND | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -1802,6 +1854,7 @@ the "slow query" condition. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -1846,6 +1899,7 @@ An event of type `alter_role` is recorded when a role is altered. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -1868,6 +1922,7 @@ An event of type `create_role` is recorded when a role is created. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -1890,6 +1945,7 @@ An event of type `drop_role` is recorded when a role is dropped. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -1925,6 +1981,7 @@ An event of type `remove_zone_config` is recorded when a zone config is removed. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | @@ -1947,6 +2004,7 @@ An event of type `set_zone_config` is recorded when a zone config is changed. | `Timestamp` | The timestamp of the event. Expressed as nanoseconds since the Unix epoch. | no | | `EventType` | The type of the event. | no | | `Statement` | A normalized copy of the SQL statement that triggered the event. | yes | +| `Tag` | The statement tag. This is separate from the statement string, since the statement string can contain sensitive information. The tag is guaranteed not to. | no | | `User` | The user account that triggered the event. | yes | | `DescriptorID` | The primary object descriptor affected by the operation. Set to zero for operations that don't affect descriptors. | no | | `ApplicationName` | The application name for the session where the event was emitted. This is included in the event to ease filtering of logging output by application. | yes | diff --git a/pkg/ccl/logictestccl/testdata/logic_test/multi_region b/pkg/ccl/logictestccl/testdata/logic_test/multi_region index f872756eba2a..c0a99c3025b3 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/multi_region +++ b/pkg/ccl/logictestccl/testdata/logic_test/multi_region @@ -1027,7 +1027,7 @@ SELECT "reportingID", info::JSONB - 'Timestamp' - 'DescriptorID' FROM system.eventlog WHERE "eventType" = 'alter_database_drop_region' ---- -1 {"DatabaseName": "drop_region_db", "EventType": "alter_database_drop_region", "RegionName": "\"us-east-1\"", "Statement": "ALTER DATABASE drop_region_db DROP REGION \"us-east-1\"", "User": "root"} +1 {"DatabaseName": "drop_region_db", "EventType": "alter_database_drop_region", "RegionName": "\"us-east-1\"", "Statement": "ALTER DATABASE drop_region_db DROP REGION \"us-east-1\"", "Tag": "ALTER DATABASE DROP REGION", "User": "root"} query TTBT colnames SHOW REGIONS FROM DATABASE drop_region_db diff --git a/pkg/sql/admin_audit_log_test.go b/pkg/sql/admin_audit_log_test.go index 806d4337d7b3..114df07a78f8 100644 --- a/pkg/sql/admin_audit_log_test.go +++ b/pkg/sql/admin_audit_log_test.go @@ -70,7 +70,7 @@ func TestAdminAuditLogBasic(t *testing.T) { db.Exec(t, `SET CLUSTER SETTING sql.log.admin_audit.enabled = true;`) db.Exec(t, `SELECT 1;`) - var selectAdminRe = regexp.MustCompile(`"EventType":"admin_query","Statement":"‹SELECT 1›","User":"‹root›"`) + var selectAdminRe = regexp.MustCompile(`"EventType":"admin_query","Statement":"‹SELECT 1›","Tag":"SELECT","User":"‹root›"`) log.Flush() diff --git a/pkg/sql/create_stats.go b/pkg/sql/create_stats.go index cc9e31d020da..00b030728aaa 100644 --- a/pkg/sql/create_stats.go +++ b/pkg/sql/create_stats.go @@ -580,6 +580,7 @@ func (r *createStatsResumer) Resume(ctx context.Context, execCtx interface{}) er evalCtx.SessionData.User(), evalCtx.SessionData.ApplicationName, details.Statement, + "CREATE STATISTICS", nil, /* no placeholders known at this point */ true, /* writeToEventLog */ &eventpb.CreateStatistics{ diff --git a/pkg/sql/event_log.go b/pkg/sql/event_log.go index e2f1fb687676..74e60b7a9e21 100644 --- a/pkg/sql/event_log.go +++ b/pkg/sql/event_log.go @@ -65,9 +65,10 @@ func (p *planner) logEventsWithSystemEventLogOption( ) error { user := p.User() stmt := tree.AsStringWithFQNames(p.stmt.AST, p.extendedEvalCtx.EvalContext.Annotations) + stmtTag := p.stmt.AST.StatementTag() pl := p.extendedEvalCtx.EvalContext.Placeholders.Values appName := p.SessionData().ApplicationName - return logEventInternalForSQLStatements(ctx, p.extendedEvalCtx.ExecCfg, p.txn, descIDs, user, appName, stmt, pl, writeToEventLog, events...) + return logEventInternalForSQLStatements(ctx, p.extendedEvalCtx.ExecCfg, p.txn, descIDs, user, appName, stmt, stmtTag, pl, writeToEventLog, events...) } // logEventInternalForSchemaChange emits a cluster event in the @@ -119,6 +120,7 @@ func logEventInternalForSQLStatements( user security.SQLUsername, appName string, stmt string, + stmtTag string, placeholders tree.QueryArguments, writeToEventLog bool, events ...eventpb.EventPayload, @@ -126,7 +128,7 @@ func logEventInternalForSQLStatements( // Inject the common fields into the payload provided by the caller. for i := range events { if err := injectCommonFields( - txn, descIDs[i], user, appName, stmt, placeholders, events[i], + txn, descIDs[i], user, appName, stmt, stmtTag, placeholders, events[i], ); err != nil { return err } @@ -152,6 +154,7 @@ func injectCommonFields( user security.SQLUsername, appName string, stmt string, + stmtTag string, placeholders tree.QueryArguments, event eventpb.EventPayload, ) error { @@ -162,6 +165,7 @@ func injectCommonFields( } m := sqlCommon.CommonSQLDetails() m.Statement = stmt + m.Tag = stmtTag m.ApplicationName = appName m.User = user.Normalized() m.DescriptorID = uint32(descID) diff --git a/pkg/sql/logictest/testdata/logic_test/distsql_event_log b/pkg/sql/logictest/testdata/logic_test/distsql_event_log index f97caee3bb77..a3f7875ca27a 100644 --- a/pkg/sql/logictest/testdata/logic_test/distsql_event_log +++ b/pkg/sql/logictest/testdata/logic_test/distsql_event_log @@ -26,8 +26,8 @@ FROM system.eventlog WHERE "eventType" = 'create_statistics' ORDER BY "timestamp", info ---- -53 1 {"EventType": "create_statistics", "Statement": "CREATE STATISTICS s1 ON id FROM test.public.a", "TableName": "test.public.a", "User": "root"} -53 1 {"EventType": "create_statistics", "Statement": "CREATE STATISTICS __auto__ FROM test.public.a", "TableName": "test.public.a", "User": "root"} +53 1 {"EventType": "create_statistics", "Statement": "CREATE STATISTICS s1 ON id FROM test.public.a", "TableName": "test.public.a", "Tag": "CREATE STATISTICS", "User": "root"} +53 1 {"EventType": "create_statistics", "Statement": "CREATE STATISTICS __auto__ FROM test.public.a", "TableName": "test.public.a", "Tag": "CREATE STATISTICS", "User": "root"} statement ok DROP TABLE a diff --git a/pkg/sql/logictest/testdata/logic_test/event_log b/pkg/sql/logictest/testdata/logic_test/event_log index cdfc2dea4433..64a9d3c5e007 100644 --- a/pkg/sql/logictest/testdata/logic_test/event_log +++ b/pkg/sql/logictest/testdata/logic_test/event_log @@ -24,12 +24,12 @@ FROM system.eventlog WHERE "eventType" IN ('create_role', 'drop_role', 'alter_role') ORDER BY "timestamp", info ---- -1 create_role {"EventType": "create_role", "RoleName": "testuser", "Statement": "CREATE USER 'testuser'", "User": "root"} -1 create_role {"EventType": "create_role", "RoleName": "r", "Statement": "CREATE ROLE 'r'", "User": "root"} -1 create_role {"EventType": "create_role", "RoleName": "r2", "Statement": "CREATE ROLE IF NOT EXISTS 'r2'", "User": "root"} -1 alter_role {"EventType": "alter_role", "Options": ["CONTROLCHANGEFEED"], "RoleName": "r", "Statement": "ALTER ROLE 'r' WITH CONTROLCHANGEFEED", "User": "root"} -1 drop_role {"EventType": "drop_role", "RoleName": "r", "Statement": "DROP ROLE 'r', 'r2'", "User": "root"} -1 drop_role {"EventType": "drop_role", "RoleName": "r2", "Statement": "DROP ROLE 'r', 'r2'", "User": "root"} +1 create_role {"EventType": "create_role", "RoleName": "testuser", "Statement": "CREATE USER 'testuser'", "Tag": "CREATE ROLE", "User": "root"} +1 create_role {"EventType": "create_role", "RoleName": "r", "Statement": "CREATE ROLE 'r'", "Tag": "CREATE ROLE", "User": "root"} +1 create_role {"EventType": "create_role", "RoleName": "r2", "Statement": "CREATE ROLE IF NOT EXISTS 'r2'", "Tag": "CREATE ROLE", "User": "root"} +1 alter_role {"EventType": "alter_role", "Options": ["CONTROLCHANGEFEED"], "RoleName": "r", "Statement": "ALTER ROLE 'r' WITH CONTROLCHANGEFEED", "Tag": "ALTER ROLE", "User": "root"} +1 drop_role {"EventType": "drop_role", "RoleName": "r", "Statement": "DROP ROLE 'r', 'r2'", "Tag": "DROP ROLE", "User": "root"} +1 drop_role {"EventType": "drop_role", "RoleName": "r2", "Statement": "DROP ROLE 'r', 'r2'", "Tag": "DROP ROLE", "User": "root"} # Create two tables + superfluous "IF NOT EXISTS" ################## @@ -54,8 +54,8 @@ SELECT "reportingID", info::JSONB - 'Timestamp' - 'DescriptorID' WHERE "eventType" = 'create_table' ORDER BY "timestamp", info ---- -1 {"EventType": "create_table", "Statement": "CREATE TABLE test.public.a (id INT8 PRIMARY KEY)", "TableName": "test.public.a", "User": "root"} -1 {"EventType": "create_table", "Statement": "CREATE TABLE IF NOT EXISTS test.public.b (id INT8 PRIMARY KEY)", "TableName": "test.public.b", "User": "root"} +1 {"EventType": "create_table", "Statement": "CREATE TABLE test.public.a (id INT8 PRIMARY KEY)", "TableName": "test.public.a", "Tag": "CREATE TABLE", "User": "root"} +1 {"EventType": "create_table", "Statement": "CREATE TABLE IF NOT EXISTS test.public.b (id INT8 PRIMARY KEY)", "TableName": "test.public.b", "Tag": "CREATE TABLE", "User": "root"} # Verify the contents of the 'Info' field of each log message using a LIKE # statement. @@ -67,7 +67,7 @@ FROM system.eventlog WHERE "eventType" = 'create_table' AND info::JSONB->>'Statement' LIKE 'CREATE TABLE test.public.a%' ---- -1 {"EventType": "create_table", "Statement": "CREATE TABLE test.public.a (id INT8 PRIMARY KEY)", "TableName": "test.public.a", "User": "root"} +1 {"EventType": "create_table", "Statement": "CREATE TABLE test.public.a (id INT8 PRIMARY KEY)", "TableName": "test.public.a", "Tag": "CREATE TABLE", "User": "root"} query IT SELECT "reportingID", info::JSONB - 'Timestamp' - 'DescriptorID' @@ -75,7 +75,7 @@ FROM system.eventlog WHERE "eventType" = 'create_table' AND info::JSONB->>'Statement' LIKE 'CREATE TABLE IF NOT EXISTS test.public.b%' ---- -1 {"EventType": "create_table", "Statement": "CREATE TABLE IF NOT EXISTS test.public.b (id INT8 PRIMARY KEY)", "TableName": "test.public.b", "User": "root"} +1 {"EventType": "create_table", "Statement": "CREATE TABLE IF NOT EXISTS test.public.b (id INT8 PRIMARY KEY)", "TableName": "test.public.b", "Tag": "CREATE TABLE", "User": "root"} # Sanity check - check for a non-matching info value. ################## @@ -103,7 +103,7 @@ query IT SELECT "reportingID", info::JSONB - 'Timestamp' - 'DescriptorID' FROM system.eventlog WHERE "eventType" = 'alter_table' ---- -1 {"EventType": "alter_table", "MutationID": 1, "Statement": "ALTER TABLE test.public.a ADD COLUMN val INT8", "TableName": "test.public.a", "User": "root"} +1 {"EventType": "alter_table", "MutationID": 1, "Statement": "ALTER TABLE test.public.a ADD COLUMN val INT8", "TableName": "test.public.a", "Tag": "ALTER TABLE", "User": "root"} query IT SELECT "reportingID", info::JSONB - 'Timestamp' - 'DescriptorID' FROM system.eventlog @@ -124,7 +124,7 @@ SELECT "reportingID", info::JSONB - 'Timestamp' - 'DescriptorID' FROM system.eve WHERE "eventType" = 'alter_table' AND info::JSONB->>'Statement' LIKE 'ALTER TABLE test.public.a%' ---- -1 {"EventType": "alter_table", "MutationID": 1, "Statement": "ALTER TABLE test.public.a ADD COLUMN val INT8", "TableName": "test.public.a", "User": "root"} +1 {"EventType": "alter_table", "MutationID": 1, "Statement": "ALTER TABLE test.public.a ADD COLUMN val INT8", "TableName": "test.public.a", "Tag": "ALTER TABLE", "User": "root"} # Add a UNIQUE constraint to the table in a way that will ensure the schema # change is reversed. @@ -141,8 +141,8 @@ SELECT "reportingID", info::JSONB - 'Timestamp' - 'DescriptorID' FROM system.eve WHERE "eventType" = 'alter_table' ORDER BY "timestamp", info ---- -1 {"EventType": "alter_table", "MutationID": 1, "Statement": "ALTER TABLE test.public.a ADD COLUMN val INT8", "TableName": "test.public.a", "User": "root"} -1 {"EventType": "alter_table", "MutationID": 2, "Statement": "ALTER TABLE test.public.a ADD CONSTRAINT foo UNIQUE (val)", "TableName": "test.public.a", "User": "root"} +1 {"EventType": "alter_table", "MutationID": 1, "Statement": "ALTER TABLE test.public.a ADD COLUMN val INT8", "TableName": "test.public.a", "Tag": "ALTER TABLE", "User": "root"} +1 {"EventType": "alter_table", "MutationID": 2, "Statement": "ALTER TABLE test.public.a ADD CONSTRAINT foo UNIQUE (val)", "TableName": "test.public.a", "Tag": "ALTER TABLE", "User": "root"} query IT SELECT "reportingID", info::JSONB - 'Timestamp' - 'DescriptorID' FROM system.eventlog @@ -175,7 +175,7 @@ SELECT "reportingID", info::JSONB - 'Timestamp' - 'DescriptorID' FROM system.eve WHERE "eventType" = 'create_index' AND info::JSONB->>'Statement' LIKE 'CREATE INDEX %a_foo%' ---- -1 {"EventType": "create_index", "IndexName": "a_foo", "MutationID": 3, "Statement": "CREATE INDEX a_foo ON test.public.a (val)", "TableName": "test.public.a", "User": "root"} +1 {"EventType": "create_index", "IndexName": "a_foo", "MutationID": 3, "Statement": "CREATE INDEX a_foo ON test.public.a (val)", "TableName": "test.public.a", "Tag": "CREATE INDEX", "User": "root"} query IT SELECT "reportingID", info::JSONB - 'Timestamp' - 'DescriptorID' FROM system.eventlog @@ -193,7 +193,7 @@ SELECT "reportingID", info::JSONB - 'Timestamp' - 'DescriptorID' FROM system.eve WHERE "eventType" = 'create_index' AND info::JSONB->>'Statement' LIKE 'CREATE INDEX ON%' ---- -1 {"EventType": "create_index", "IndexName": "a_val_idx", "MutationID": 4, "Statement": "CREATE INDEX ON test.public.a (val)", "TableName": "test.public.a", "User": "root"} +1 {"EventType": "create_index", "IndexName": "a_val_idx", "MutationID": 4, "Statement": "CREATE INDEX ON test.public.a (val)", "TableName": "test.public.a", "Tag": "CREATE INDEX", "User": "root"} query IT SELECT "reportingID", info::JSONB - 'Timestamp' - 'DescriptorID' FROM system.eventlog @@ -216,7 +216,7 @@ SELECT "reportingID", info::JSONB - 'Timestamp' - 'DescriptorID' FROM system.eve WHERE "eventType" = 'drop_index' AND info::JSONB->>'Statement' LIKE 'DROP INDEX%a_foo' ---- -1 {"EventType": "drop_index", "IndexName": "a_foo", "MutationID": 5, "Statement": "DROP INDEX test.public.a@a_foo", "TableName": "test.public.a", "User": "root"} +1 {"EventType": "drop_index", "IndexName": "a_foo", "MutationID": 5, "Statement": "DROP INDEX test.public.a@a_foo", "TableName": "test.public.a", "Tag": "DROP INDEX", "User": "root"} query IT SELECT "reportingID", info::JSONB - 'Timestamp' - 'DescriptorID' FROM system.eventlog @@ -239,7 +239,7 @@ SELECT "reportingID", info::JSONB - 'Timestamp' - 'DescriptorID' FROM system.eventlog WHERE "eventType" = 'truncate_table' ---- -1 {"EventType": "truncate_table", "Statement": "TRUNCATE TABLE test.public.a", "TableName": "test.public.a", "User": "root"} +1 {"EventType": "truncate_table", "Statement": "TRUNCATE TABLE test.public.a", "TableName": "test.public.a", "Tag": "TRUNCATE", "User": "root"} # Drop both tables + superfluous "IF EXISTS" ################## @@ -264,8 +264,8 @@ FROM system.eventlog WHERE "eventType" = 'drop_table' ORDER BY "timestamp", info ---- -1 {"EventType": "drop_table", "Statement": "DROP TABLE test.public.a", "TableName": "test.public.a", "User": "root"} -1 {"EventType": "drop_table", "Statement": "DROP TABLE IF EXISTS test.public.b", "TableName": "test.public.b", "User": "root"} +1 {"EventType": "drop_table", "Statement": "DROP TABLE test.public.a", "TableName": "test.public.a", "Tag": "DROP TABLE", "User": "root"} +1 {"EventType": "drop_table", "Statement": "DROP TABLE IF EXISTS test.public.b", "TableName": "test.public.b", "Tag": "DROP TABLE", "User": "root"} # Verify the contents of the 'info' field of each event. ################## @@ -276,7 +276,7 @@ FROM system.eventlog WHERE "eventType" = 'drop_table' AND info::JSONB->>'Statement' LIKE 'DROP TABLE test.public.a%' ---- -1 {"EventType": "drop_table", "Statement": "DROP TABLE test.public.a", "TableName": "test.public.a", "User": "root"} +1 {"EventType": "drop_table", "Statement": "DROP TABLE test.public.a", "TableName": "test.public.a", "Tag": "DROP TABLE", "User": "root"} query IT SELECT "reportingID", info::JSONB - 'Timestamp' - 'DescriptorID' @@ -284,7 +284,7 @@ FROM system.eventlog WHERE "eventType" = 'drop_table' AND info::JSONB->>'Statement' LIKE 'DROP TABLE IF EXISTS test.public.b%' ---- -1 {"EventType": "drop_table", "Statement": "DROP TABLE IF EXISTS test.public.b", "TableName": "test.public.b", "User": "root"} +1 {"EventType": "drop_table", "Statement": "DROP TABLE IF EXISTS test.public.b", "TableName": "test.public.b", "Tag": "DROP TABLE", "User": "root"} # Create + Rename table ################## @@ -305,7 +305,7 @@ FROM system.eventlog WHERE "eventType" = 'rename_table' AND info::JSONB->>'Statement' LIKE 'ALTER TABLE %toberenamed% RENAME TO %renamedtable%' ---- -1 {"EventType": "rename_table", "NewTableName": "test.public.renamedtable", "Statement": "ALTER TABLE toberenamed RENAME TO renamedtable", "TableName": "test.public.toberenamed", "User": "root"} +1 {"EventType": "rename_table", "NewTableName": "test.public.renamedtable", "Statement": "ALTER TABLE toberenamed RENAME TO renamedtable", "TableName": "test.public.toberenamed", "Tag": "RENAME TABLE", "User": "root"} ################## @@ -334,7 +334,7 @@ FROM system.eventlog WHERE "eventType" = 'create_database' AND info::JSONB->>'Statement' LIKE 'CREATE DATABASE eventlogtest%' ---- -1 {"DatabaseName": "eventlogtest", "EventType": "create_database", "Statement": "CREATE DATABASE eventlogtest", "User": "root"} +1 {"DatabaseName": "eventlogtest", "EventType": "create_database", "Statement": "CREATE DATABASE eventlogtest", "Tag": "CREATE DATABASE", "User": "root"} query IT SELECT "reportingID", info::JSONB - 'Timestamp' - 'DescriptorID' @@ -342,7 +342,7 @@ FROM system.eventlog WHERE "eventType" = 'create_database' AND info::JSONB->>'Statement' LIKE 'CREATE DATABASE IF NOT EXISTS othereventlogtest%' ---- -1 {"DatabaseName": "othereventlogtest", "EventType": "create_database", "Statement": "CREATE DATABASE IF NOT EXISTS othereventlogtest", "User": "root"} +1 {"DatabaseName": "othereventlogtest", "EventType": "create_database", "Statement": "CREATE DATABASE IF NOT EXISTS othereventlogtest", "Tag": "CREATE DATABASE", "User": "root"} # Add some tables to eventlogtest. ################## @@ -379,7 +379,7 @@ FROM system.eventlog WHERE "eventType" = 'drop_database' AND info::JSONB->>'Statement' LIKE 'DROP DATABASE eventlogtest%' ---- -1 {"DatabaseName": "eventlogtest", "DroppedSchemaObjects": ["eventlogtest.public.anothertesttable", "eventlogtest.public.testtable"], "EventType": "drop_database", "Statement": "DROP DATABASE eventlogtest CASCADE", "User": "root"} +1 {"DatabaseName": "eventlogtest", "DroppedSchemaObjects": ["eventlogtest.public.anothertesttable", "eventlogtest.public.testtable"], "EventType": "drop_database", "Statement": "DROP DATABASE eventlogtest CASCADE", "Tag": "DROP DATABASE", "User": "root"} query IT SELECT "reportingID", info::JSONB - 'Timestamp' - 'DescriptorID' @@ -387,7 +387,7 @@ FROM system.eventlog WHERE "eventType" = 'drop_database' AND info::JSONB->>'Statement' LIKE 'DROP DATABASE IF EXISTS othereventlogtest%' ---- -1 {"DatabaseName": "othereventlogtest", "EventType": "drop_database", "Statement": "DROP DATABASE IF EXISTS othereventlogtest CASCADE", "User": "root"} +1 {"DatabaseName": "othereventlogtest", "EventType": "drop_database", "Statement": "DROP DATABASE IF EXISTS othereventlogtest CASCADE", "Tag": "DROP DATABASE", "User": "root"} statement ok SET DATABASE = test @@ -413,7 +413,7 @@ FROM system.eventlog WHERE "eventType" = 'rename_database' AND info::JSONB->>'Statement' LIKE 'ALTER DATABASE %eventlogtorename% RENAME TO %eventlogtonewname%' ---- -1 {"DatabaseName": "eventlogtorename", "EventType": "rename_database", "NewDatabaseName": "eventlogtonewname", "Statement": "ALTER DATABASE eventlogtorename RENAME TO eventlogtonewname", "User": "root"} +1 {"DatabaseName": "eventlogtorename", "EventType": "rename_database", "NewDatabaseName": "eventlogtonewname", "Statement": "ALTER DATABASE eventlogtorename RENAME TO eventlogtonewname", "Tag": "RENAME DATABASE", "User": "root"} statement ok SET DATABASE = test @@ -429,7 +429,7 @@ SELECT "reportingID", info::JSONB - 'Timestamp' - 'DescriptorID' FROM system.eventlog WHERE "eventType" = 'convert_to_schema' ---- -1 {"DatabaseName": "eventlogtonewname", "EventType": "convert_to_schema", "NewDatabaseParent": "test", "Statement": "ALTER DATABASE eventlogtonewname CONVERT TO SCHEMA WITH PARENT test", "User": "root"} +1 {"DatabaseName": "eventlogtonewname", "EventType": "convert_to_schema", "NewDatabaseParent": "test", "Statement": "ALTER DATABASE eventlogtonewname CONVERT TO SCHEMA WITH PARENT test", "Tag": "CONVERT TO SCHEMA", "User": "root"} statement ok DROP SCHEMA eventlogtonewname @@ -466,14 +466,14 @@ AND info NOT LIKE '%sql.testing%' AND info NOT LIKE '%sql.defaults.experimental_distsql_planning%' ORDER BY "timestamp", info ---- -0 1 {"ApplicationName": "$ internal-optInToDiagnosticsStatReporting", "EventType": "set_cluster_setting", "SettingName": "diagnostics.reporting.enabled", "Statement": "SET CLUSTER SETTING \"diagnostics.reporting.enabled\" = true", "User": "root", "Value": "true"} -0 1 {"EventType": "set_cluster_setting", "SettingName": "kv.range_merge.queue_enabled", "Statement": "SET CLUSTER SETTING \"kv.range_merge.queue_enabled\" = false", "User": "root", "Value": "false"} -0 1 {"EventType": "set_cluster_setting", "PlaceholderValues": ["5"], "SettingName": "sql.stats.automatic_collection.min_stale_rows", "Statement": "SET CLUSTER SETTING \"sql.stats.automatic_collection.min_stale_rows\" = $1::INT8", "User": "root", "Value": "5"} -0 1 {"EventType": "set_cluster_setting", "SettingName": "sql.defaults.interleaved_tables.enabled", "Statement": "SET CLUSTER SETTING \"sql.defaults.interleaved_tables.enabled\" = true", "User": "root", "Value": "true"} -0 1 {"EventType": "set_cluster_setting", "SettingName": "sql.crdb_internal.table_row_statistics.as_of_time", "Statement": "SET CLUSTER SETTING \"sql.crdb_internal.table_row_statistics.as_of_time\" = e'-1\\u00B5s'", "User": "root", "Value": "-00:00:00.000001"} -0 1 {"EventType": "set_cluster_setting", "SettingName": "kv.allocator.load_based_lease_rebalancing.enabled", "Statement": "SET CLUSTER SETTING \"kv.allocator.load_based_lease_rebalancing.enabled\" = false", "User": "root", "Value": "false"} -0 1 {"EventType": "set_cluster_setting", "SettingName": "kv.allocator.load_based_lease_rebalancing.enabled", "Statement": "SET CLUSTER SETTING \"kv.allocator.load_based_lease_rebalancing.enabled\" = DEFAULT", "User": "root", "Value": "DEFAULT"} -0 1 {"EventType": "set_cluster_setting", "PlaceholderValues": ["'some string'"], "SettingName": "cluster.organization", "Statement": "SET CLUSTER SETTING \"cluster.organization\" = $1", "User": "root", "Value": "'some string'"} +0 1 {"ApplicationName": "$ internal-optInToDiagnosticsStatReporting", "EventType": "set_cluster_setting", "SettingName": "diagnostics.reporting.enabled", "Statement": "SET CLUSTER SETTING \"diagnostics.reporting.enabled\" = true", "Tag": "SET CLUSTER SETTING", "User": "root", "Value": "true"} +0 1 {"EventType": "set_cluster_setting", "SettingName": "kv.range_merge.queue_enabled", "Statement": "SET CLUSTER SETTING \"kv.range_merge.queue_enabled\" = false", "Tag": "SET CLUSTER SETTING", "User": "root", "Value": "false"} +0 1 {"EventType": "set_cluster_setting", "PlaceholderValues": ["5"], "SettingName": "sql.stats.automatic_collection.min_stale_rows", "Statement": "SET CLUSTER SETTING \"sql.stats.automatic_collection.min_stale_rows\" = $1::INT8", "Tag": "SET CLUSTER SETTING", "User": "root", "Value": "5"} +0 1 {"EventType": "set_cluster_setting", "SettingName": "sql.defaults.interleaved_tables.enabled", "Statement": "SET CLUSTER SETTING \"sql.defaults.interleaved_tables.enabled\" = true", "Tag": "SET CLUSTER SETTING", "User": "root", "Value": "true"} +0 1 {"EventType": "set_cluster_setting", "SettingName": "sql.crdb_internal.table_row_statistics.as_of_time", "Statement": "SET CLUSTER SETTING \"sql.crdb_internal.table_row_statistics.as_of_time\" = e'-1\\u00B5s'", "Tag": "SET CLUSTER SETTING", "User": "root", "Value": "-00:00:00.000001"} +0 1 {"EventType": "set_cluster_setting", "SettingName": "kv.allocator.load_based_lease_rebalancing.enabled", "Statement": "SET CLUSTER SETTING \"kv.allocator.load_based_lease_rebalancing.enabled\" = false", "Tag": "SET CLUSTER SETTING", "User": "root", "Value": "false"} +0 1 {"EventType": "set_cluster_setting", "SettingName": "kv.allocator.load_based_lease_rebalancing.enabled", "Statement": "SET CLUSTER SETTING \"kv.allocator.load_based_lease_rebalancing.enabled\" = DEFAULT", "Tag": "SET CLUSTER SETTING", "User": "root", "Value": "DEFAULT"} +0 1 {"EventType": "set_cluster_setting", "PlaceholderValues": ["'some string'"], "SettingName": "cluster.organization", "Statement": "SET CLUSTER SETTING \"cluster.organization\" = $1", "Tag": "SET CLUSTER SETTING", "User": "root", "Value": "'some string'"} # Set and unset zone configs ################## @@ -495,7 +495,7 @@ FROM system.eventlog WHERE "eventType" = 'set_zone_config' ORDER BY "timestamp", info ---- -1 {"EventType": "set_zone_config", "Options": ["range_max_bytes = 67108865", "range_min_bytes = 16777216"], "Statement": "ALTER TABLE \"\".\"\".a CONFIGURE ZONE USING range_max_bytes = 67108865, range_min_bytes = 16777216", "Target": "TABLE test.public.a", "User": "root"} +1 {"EventType": "set_zone_config", "Options": ["range_max_bytes = 67108865", "range_min_bytes = 16777216"], "Statement": "ALTER TABLE \"\".\"\".a CONFIGURE ZONE USING range_max_bytes = 67108865, range_min_bytes = 16777216", "Tag": "CONFIGURE ZONE", "Target": "TABLE test.public.a", "User": "root"} query IT SELECT "reportingID", "info"::JSONB - 'Timestamp' - 'DescriptorID' @@ -503,7 +503,7 @@ FROM system.eventlog WHERE "eventType" = 'remove_zone_config' ORDER BY "timestamp", info ---- -1 {"EventType": "remove_zone_config", "Statement": "ALTER TABLE \"\".\"\".a CONFIGURE ZONE DISCARD", "Target": "TABLE test.public.a", "User": "root"} +1 {"EventType": "remove_zone_config", "Statement": "ALTER TABLE \"\".\"\".a CONFIGURE ZONE DISCARD", "Tag": "CONFIGURE ZONE", "Target": "TABLE test.public.a", "User": "root"} statement ok DROP TABLE a @@ -525,9 +525,9 @@ SELECT "eventType", "reportingID", info::JSONB - 'Timestamp' - 'DescriptorID' WHERE "eventType" in ('create_sequence', 'alter_sequence', 'drop_sequence') ORDER BY "timestamp", info ---- -create_sequence 1 {"EventType": "create_sequence", "SequenceName": "test.public.s", "Statement": "CREATE SEQUENCE test.public.s", "User": "root"} -alter_sequence 1 {"EventType": "alter_sequence", "SequenceName": "test.public.s", "Statement": "ALTER SEQUENCE test.public.s START 10", "User": "root"} -drop_sequence 1 {"EventType": "drop_sequence", "SequenceName": "test.public.s", "Statement": "DROP SEQUENCE test.public.s", "User": "root"} +create_sequence 1 {"EventType": "create_sequence", "SequenceName": "test.public.s", "Statement": "CREATE SEQUENCE test.public.s", "Tag": "CREATE SEQUENCE", "User": "root"} +alter_sequence 1 {"EventType": "alter_sequence", "SequenceName": "test.public.s", "Statement": "ALTER SEQUENCE test.public.s START 10", "Tag": "ALTER SEQUENCE", "User": "root"} +drop_sequence 1 {"EventType": "drop_sequence", "SequenceName": "test.public.s", "Statement": "DROP SEQUENCE test.public.s", "Tag": "DROP SEQUENCE", "User": "root"} # Views @@ -543,8 +543,8 @@ SELECT "eventType", "reportingID", info::JSONB - 'Timestamp' - 'DescriptorID' WHERE "eventType" in ('create_view', 'drop_view') ORDER BY "timestamp", info ---- -create_view 1 {"EventType": "create_view", "Statement": "CREATE VIEW \"\".\"\".v AS SELECT 1", "User": "root", "ViewName": "test.public.v", "ViewQuery": "SELECT 1"} -drop_view 1 {"EventType": "drop_view", "Statement": "DROP VIEW test.public.v", "User": "root", "ViewName": "test.public.v"} +create_view 1 {"EventType": "create_view", "Statement": "CREATE VIEW \"\".\"\".v AS SELECT 1", "Tag": "CREATE VIEW", "User": "root", "ViewName": "test.public.v", "ViewQuery": "SELECT 1"} +drop_view 1 {"EventType": "drop_view", "Statement": "DROP VIEW test.public.v", "Tag": "DROP VIEW", "User": "root", "ViewName": "test.public.v"} # Change privileges @@ -610,28 +610,28 @@ FROM system.eventlog WHERE "eventType" LIKE 'change_%_privilege' ORDER BY "timestamp", info ---- -1 {"EventType": "change_table_privilege", "GrantedPrivileges": ["INSERT"], "Grantee": "u", "Statement": "GRANT INSERT ON TABLE a, b TO u", "TableName": "a", "User": "root"} change_table_privilege -1 {"EventType": "change_table_privilege", "GrantedPrivileges": ["INSERT"], "Grantee": "u", "Statement": "GRANT INSERT ON TABLE a, b TO u", "TableName": "b", "User": "root"} change_table_privilege -1 {"EventType": "change_table_privilege", "GrantedPrivileges": ["SELECT"], "Grantee": "u", "Statement": "GRANT SELECT ON TABLE sq TO u", "TableName": "sq", "User": "root"} change_table_privilege -1 {"EventType": "change_table_privilege", "GrantedPrivileges": ["SELECT"], "Grantee": "u", "Statement": "GRANT SELECT ON TABLE c TO u", "TableName": "c", "User": "root"} change_table_privilege -1 {"DatabaseName": "dbt", "EventType": "change_database_privilege", "GrantedPrivileges": ["CREATE"], "Grantee": "u", "Statement": "GRANT CREATE ON DATABASE dbt TO u", "User": "root"} change_database_privilege -1 {"EventType": "change_schema_privilege", "GrantedPrivileges": ["CREATE"], "Grantee": "u", "SchemaName": "sc", "Statement": "GRANT CREATE ON SCHEMA \"\".sc TO u", "User": "root"} change_schema_privilege -1 {"EventType": "change_table_privilege", "Grantee": "u", "RevokedPrivileges": ["UPDATE"], "Statement": "REVOKE UPDATE ON TABLE a FROM u, v", "TableName": "a", "User": "root"} change_table_privilege -1 {"EventType": "change_table_privilege", "Grantee": "v", "RevokedPrivileges": ["UPDATE"], "Statement": "REVOKE UPDATE ON TABLE a FROM u, v", "TableName": "a", "User": "root"} change_table_privilege -1 {"EventType": "change_schema_privilege", "Grantee": "u", "RevokedPrivileges": ["CREATE"], "SchemaName": "sc", "Statement": "REVOKE CREATE ON SCHEMA \"\".sc FROM u, v", "User": "root"} change_schema_privilege -1 {"EventType": "change_schema_privilege", "Grantee": "v", "RevokedPrivileges": ["CREATE"], "SchemaName": "sc", "Statement": "REVOKE CREATE ON SCHEMA \"\".sc FROM u, v", "User": "root"} change_schema_privilege -1 {"DatabaseName": "dbt", "EventType": "change_database_privilege", "Grantee": "u", "RevokedPrivileges": ["CREATE"], "Statement": "REVOKE CREATE ON DATABASE dbt FROM u, v", "User": "root"} change_database_privilege -1 {"DatabaseName": "dbt", "EventType": "change_database_privilege", "Grantee": "v", "RevokedPrivileges": ["CREATE"], "Statement": "REVOKE CREATE ON DATABASE dbt FROM u, v", "User": "root"} change_database_privilege -1 {"EventType": "change_table_privilege", "GrantedPrivileges": ["ALL"], "Grantee": "u", "Statement": "GRANT ALL ON TABLE * TO u", "TableName": "renamedtable", "User": "root"} change_table_privilege -1 {"EventType": "change_table_privilege", "GrantedPrivileges": ["ALL"], "Grantee": "u", "Statement": "GRANT ALL ON TABLE * TO u", "TableName": "a", "User": "root"} change_table_privilege -1 {"EventType": "change_table_privilege", "GrantedPrivileges": ["ALL"], "Grantee": "u", "Statement": "GRANT ALL ON TABLE * TO u", "TableName": "b", "User": "root"} change_table_privilege -1 {"EventType": "change_table_privilege", "GrantedPrivileges": ["ALL"], "Grantee": "u", "Statement": "GRANT ALL ON TABLE * TO u", "TableName": "c", "User": "root"} change_table_privilege -1 {"EventType": "change_table_privilege", "GrantedPrivileges": ["ALL"], "Grantee": "u", "Statement": "GRANT ALL ON TABLE * TO u", "TableName": "sq", "User": "root"} change_table_privilege -1 {"EventType": "change_table_privilege", "Grantee": "u", "RevokedPrivileges": ["ALL"], "Statement": "REVOKE ALL ON TABLE * FROM u", "TableName": "renamedtable", "User": "root"} change_table_privilege -1 {"EventType": "change_table_privilege", "Grantee": "u", "RevokedPrivileges": ["ALL"], "Statement": "REVOKE ALL ON TABLE * FROM u", "TableName": "a", "User": "root"} change_table_privilege -1 {"EventType": "change_table_privilege", "Grantee": "u", "RevokedPrivileges": ["ALL"], "Statement": "REVOKE ALL ON TABLE * FROM u", "TableName": "b", "User": "root"} change_table_privilege -1 {"EventType": "change_table_privilege", "Grantee": "u", "RevokedPrivileges": ["ALL"], "Statement": "REVOKE ALL ON TABLE * FROM u", "TableName": "c", "User": "root"} change_table_privilege -1 {"EventType": "change_table_privilege", "Grantee": "u", "RevokedPrivileges": ["ALL"], "Statement": "REVOKE ALL ON TABLE * FROM u", "TableName": "sq", "User": "root"} change_table_privilege +1 {"EventType": "change_table_privilege", "GrantedPrivileges": ["INSERT"], "Grantee": "u", "Statement": "GRANT INSERT ON TABLE a, b TO u", "TableName": "a", "Tag": "GRANT", "User": "root"} change_table_privilege +1 {"EventType": "change_table_privilege", "GrantedPrivileges": ["INSERT"], "Grantee": "u", "Statement": "GRANT INSERT ON TABLE a, b TO u", "TableName": "b", "Tag": "GRANT", "User": "root"} change_table_privilege +1 {"EventType": "change_table_privilege", "GrantedPrivileges": ["SELECT"], "Grantee": "u", "Statement": "GRANT SELECT ON TABLE sq TO u", "TableName": "sq", "Tag": "GRANT", "User": "root"} change_table_privilege +1 {"EventType": "change_table_privilege", "GrantedPrivileges": ["SELECT"], "Grantee": "u", "Statement": "GRANT SELECT ON TABLE c TO u", "TableName": "c", "Tag": "GRANT", "User": "root"} change_table_privilege +1 {"DatabaseName": "dbt", "EventType": "change_database_privilege", "GrantedPrivileges": ["CREATE"], "Grantee": "u", "Statement": "GRANT CREATE ON DATABASE dbt TO u", "Tag": "GRANT", "User": "root"} change_database_privilege +1 {"EventType": "change_schema_privilege", "GrantedPrivileges": ["CREATE"], "Grantee": "u", "SchemaName": "sc", "Statement": "GRANT CREATE ON SCHEMA \"\".sc TO u", "Tag": "GRANT", "User": "root"} change_schema_privilege +1 {"EventType": "change_table_privilege", "Grantee": "u", "RevokedPrivileges": ["UPDATE"], "Statement": "REVOKE UPDATE ON TABLE a FROM u, v", "TableName": "a", "Tag": "REVOKE", "User": "root"} change_table_privilege +1 {"EventType": "change_table_privilege", "Grantee": "v", "RevokedPrivileges": ["UPDATE"], "Statement": "REVOKE UPDATE ON TABLE a FROM u, v", "TableName": "a", "Tag": "REVOKE", "User": "root"} change_table_privilege +1 {"EventType": "change_schema_privilege", "Grantee": "u", "RevokedPrivileges": ["CREATE"], "SchemaName": "sc", "Statement": "REVOKE CREATE ON SCHEMA \"\".sc FROM u, v", "Tag": "REVOKE", "User": "root"} change_schema_privilege +1 {"EventType": "change_schema_privilege", "Grantee": "v", "RevokedPrivileges": ["CREATE"], "SchemaName": "sc", "Statement": "REVOKE CREATE ON SCHEMA \"\".sc FROM u, v", "Tag": "REVOKE", "User": "root"} change_schema_privilege +1 {"DatabaseName": "dbt", "EventType": "change_database_privilege", "Grantee": "u", "RevokedPrivileges": ["CREATE"], "Statement": "REVOKE CREATE ON DATABASE dbt FROM u, v", "Tag": "REVOKE", "User": "root"} change_database_privilege +1 {"DatabaseName": "dbt", "EventType": "change_database_privilege", "Grantee": "v", "RevokedPrivileges": ["CREATE"], "Statement": "REVOKE CREATE ON DATABASE dbt FROM u, v", "Tag": "REVOKE", "User": "root"} change_database_privilege +1 {"EventType": "change_table_privilege", "GrantedPrivileges": ["ALL"], "Grantee": "u", "Statement": "GRANT ALL ON TABLE * TO u", "TableName": "renamedtable", "Tag": "GRANT", "User": "root"} change_table_privilege +1 {"EventType": "change_table_privilege", "GrantedPrivileges": ["ALL"], "Grantee": "u", "Statement": "GRANT ALL ON TABLE * TO u", "TableName": "a", "Tag": "GRANT", "User": "root"} change_table_privilege +1 {"EventType": "change_table_privilege", "GrantedPrivileges": ["ALL"], "Grantee": "u", "Statement": "GRANT ALL ON TABLE * TO u", "TableName": "b", "Tag": "GRANT", "User": "root"} change_table_privilege +1 {"EventType": "change_table_privilege", "GrantedPrivileges": ["ALL"], "Grantee": "u", "Statement": "GRANT ALL ON TABLE * TO u", "TableName": "c", "Tag": "GRANT", "User": "root"} change_table_privilege +1 {"EventType": "change_table_privilege", "GrantedPrivileges": ["ALL"], "Grantee": "u", "Statement": "GRANT ALL ON TABLE * TO u", "TableName": "sq", "Tag": "GRANT", "User": "root"} change_table_privilege +1 {"EventType": "change_table_privilege", "Grantee": "u", "RevokedPrivileges": ["ALL"], "Statement": "REVOKE ALL ON TABLE * FROM u", "TableName": "renamedtable", "Tag": "REVOKE", "User": "root"} change_table_privilege +1 {"EventType": "change_table_privilege", "Grantee": "u", "RevokedPrivileges": ["ALL"], "Statement": "REVOKE ALL ON TABLE * FROM u", "TableName": "a", "Tag": "REVOKE", "User": "root"} change_table_privilege +1 {"EventType": "change_table_privilege", "Grantee": "u", "RevokedPrivileges": ["ALL"], "Statement": "REVOKE ALL ON TABLE * FROM u", "TableName": "b", "Tag": "REVOKE", "User": "root"} change_table_privilege +1 {"EventType": "change_table_privilege", "Grantee": "u", "RevokedPrivileges": ["ALL"], "Statement": "REVOKE ALL ON TABLE * FROM u", "TableName": "c", "Tag": "REVOKE", "User": "root"} change_table_privilege +1 {"EventType": "change_table_privilege", "Grantee": "u", "RevokedPrivileges": ["ALL"], "Statement": "REVOKE ALL ON TABLE * FROM u", "TableName": "sq", "Tag": "REVOKE", "User": "root"} change_table_privilege statement ok DROP DATABASE dbt @@ -675,9 +675,9 @@ FROM system.eventlog WHERE "eventType" = 'create_schema' ORDER BY "timestamp", info ---- -1 {"EventType": "create_schema", "Owner": "root", "SchemaName": "test.sc", "Statement": "CREATE SCHEMA \"\".sc", "User": "root"} -1 {"EventType": "create_schema", "Owner": "root", "SchemaName": "test.s", "Statement": "CREATE SCHEMA \"\".s", "User": "root"} -1 {"EventType": "create_schema", "Owner": "u", "SchemaName": "test.u", "Statement": "CREATE SCHEMA AUTHORIZATION u", "User": "root"} +1 {"EventType": "create_schema", "Owner": "root", "SchemaName": "test.sc", "Statement": "CREATE SCHEMA \"\".sc", "Tag": "CREATE SCHEMA", "User": "root"} +1 {"EventType": "create_schema", "Owner": "root", "SchemaName": "test.s", "Statement": "CREATE SCHEMA \"\".s", "Tag": "CREATE SCHEMA", "User": "root"} +1 {"EventType": "create_schema", "Owner": "u", "SchemaName": "test.u", "Statement": "CREATE SCHEMA AUTHORIZATION u", "Tag": "CREATE SCHEMA", "User": "root"} statement ok ALTER SCHEMA u RENAME TO t @@ -687,7 +687,7 @@ SELECT "reportingID", info::JSONB - 'Timestamp' - 'DescriptorID' FROM system.eventlog WHERE "eventType" = 'rename_schema' ---- -1 {"EventType": "rename_schema", "NewSchemaName": "test.t", "SchemaName": "test.u", "Statement": "ALTER SCHEMA \"\".u RENAME TO t", "User": "root"} +1 {"EventType": "rename_schema", "NewSchemaName": "test.t", "SchemaName": "test.u", "Statement": "ALTER SCHEMA \"\".u RENAME TO t", "Tag": "ALTER SCHEMA", "User": "root"} statement ok DROP SCHEMA s, t @@ -701,10 +701,10 @@ FROM system.eventlog WHERE "eventType" = 'drop_schema' ORDER BY "timestamp", info ---- -1 {"EventType": "drop_schema", "SchemaName": "test.eventlogtonewname", "Statement": "DROP SCHEMA \"\".eventlogtonewname", "User": "root"} -1 {"EventType": "drop_schema", "SchemaName": "test.sc", "Statement": "DROP SCHEMA \"\".sc", "User": "root"} -1 {"EventType": "drop_schema", "SchemaName": "test.s", "Statement": "DROP SCHEMA \"\".s, \"\".t", "User": "root"} -1 {"EventType": "drop_schema", "SchemaName": "test.t", "Statement": "DROP SCHEMA \"\".s, \"\".t", "User": "root"} +1 {"EventType": "drop_schema", "SchemaName": "test.eventlogtonewname", "Statement": "DROP SCHEMA \"\".eventlogtonewname", "Tag": "DROP SCHEMA", "User": "root"} +1 {"EventType": "drop_schema", "SchemaName": "test.sc", "Statement": "DROP SCHEMA \"\".sc", "Tag": "DROP SCHEMA", "User": "root"} +1 {"EventType": "drop_schema", "SchemaName": "test.s", "Statement": "DROP SCHEMA \"\".s, \"\".t", "Tag": "DROP SCHEMA", "User": "root"} +1 {"EventType": "drop_schema", "SchemaName": "test.t", "Statement": "DROP SCHEMA \"\".s, \"\".t", "Tag": "DROP SCHEMA", "User": "root"} subtest eventlog_setting_disable @@ -818,11 +818,11 @@ SELECT "reportingID", "eventType", info::JSONB - 'Timestamp' - 'DescriptorID' WHERE "eventType" LIKE '%_owner' ORDER BY "timestamp", info ---- -1 alter_database_owner {"DatabaseName": "atest", "EventType": "alter_database_owner", "Owner": "u", "Statement": "ALTER DATABASE atest OWNER TO u", "User": "root"} -1 alter_schema_owner {"EventType": "alter_schema_owner", "Owner": "u", "SchemaName": "atest.sc", "Statement": "ALTER SCHEMA atest.sc OWNER TO u", "User": "root"} -1 alter_table_owner {"EventType": "alter_table_owner", "Owner": "u", "Statement": "ALTER TABLE atest.sc.t OWNER TO u", "TableName": "atest.sc.t", "User": "root"} -1 alter_type_owner {"EventType": "alter_type_owner", "Owner": "u", "Statement": "ALTER TYPE atest.sc.ty OWNER TO u", "TypeName": "ty", "User": "root"} -1 alter_type_owner {"EventType": "alter_type_owner", "Owner": "u", "Statement": "ALTER TYPE atest.sc.ty OWNER TO u", "TypeName": "_ty", "User": "root"} +1 alter_database_owner {"DatabaseName": "atest", "EventType": "alter_database_owner", "Owner": "u", "Statement": "ALTER DATABASE atest OWNER TO u", "Tag": "ALTER DATABASE OWNER", "User": "root"} +1 alter_schema_owner {"EventType": "alter_schema_owner", "Owner": "u", "SchemaName": "atest.sc", "Statement": "ALTER SCHEMA atest.sc OWNER TO u", "Tag": "ALTER SCHEMA", "User": "root"} +1 alter_table_owner {"EventType": "alter_table_owner", "Owner": "u", "Statement": "ALTER TABLE atest.sc.t OWNER TO u", "TableName": "atest.sc.t", "Tag": "ALTER TABLE OWNER", "User": "root"} +1 alter_type_owner {"EventType": "alter_type_owner", "Owner": "u", "Statement": "ALTER TYPE atest.sc.ty OWNER TO u", "Tag": "ALTER TYPE", "TypeName": "ty", "User": "root"} +1 alter_type_owner {"EventType": "alter_type_owner", "Owner": "u", "Statement": "ALTER TYPE atest.sc.ty OWNER TO u", "Tag": "ALTER TYPE", "TypeName": "_ty", "User": "root"} subtest alter_owner @@ -857,13 +857,13 @@ SELECT "reportingID", "eventType", info::JSONB - 'Timestamp' - 'DescriptorID' WHERE "eventType" LIKE '%_owner' AND info::JSONB->>'Owner' = 'v' ORDER BY "timestamp", info ---- -1 alter_database_owner {"DatabaseName": "atest", "EventType": "alter_database_owner", "Owner": "v", "Statement": "REASSIGN OWNED BY testuser TO v", "User": "root"} -1 alter_schema_owner {"EventType": "alter_schema_owner", "Owner": "v", "SchemaName": "atest.sc", "Statement": "REASSIGN OWNED BY testuser TO v", "User": "root"} -1 alter_table_owner {"EventType": "alter_table_owner", "Owner": "v", "Statement": "REASSIGN OWNED BY testuser TO v", "TableName": "atest.sc.t", "User": "root"} -1 alter_table_owner {"EventType": "alter_table_owner", "Owner": "v", "Statement": "REASSIGN OWNED BY testuser TO v", "TableName": "atest.sc.v", "User": "root"} -1 alter_table_owner {"EventType": "alter_table_owner", "Owner": "v", "Statement": "REASSIGN OWNED BY testuser TO v", "TableName": "atest.sc.s", "User": "root"} -1 alter_type_owner {"EventType": "alter_type_owner", "Owner": "v", "Statement": "REASSIGN OWNED BY testuser TO v", "TypeName": "ty", "User": "root"} -1 alter_type_owner {"EventType": "alter_type_owner", "Owner": "v", "Statement": "REASSIGN OWNED BY testuser TO v", "TypeName": "_ty", "User": "root"} +1 alter_database_owner {"DatabaseName": "atest", "EventType": "alter_database_owner", "Owner": "v", "Statement": "REASSIGN OWNED BY testuser TO v", "Tag": "REASSIGN OWNED BY", "User": "root"} +1 alter_schema_owner {"EventType": "alter_schema_owner", "Owner": "v", "SchemaName": "atest.sc", "Statement": "REASSIGN OWNED BY testuser TO v", "Tag": "REASSIGN OWNED BY", "User": "root"} +1 alter_table_owner {"EventType": "alter_table_owner", "Owner": "v", "Statement": "REASSIGN OWNED BY testuser TO v", "TableName": "atest.sc.t", "Tag": "REASSIGN OWNED BY", "User": "root"} +1 alter_table_owner {"EventType": "alter_table_owner", "Owner": "v", "Statement": "REASSIGN OWNED BY testuser TO v", "TableName": "atest.sc.v", "Tag": "REASSIGN OWNED BY", "User": "root"} +1 alter_table_owner {"EventType": "alter_table_owner", "Owner": "v", "Statement": "REASSIGN OWNED BY testuser TO v", "TableName": "atest.sc.s", "Tag": "REASSIGN OWNED BY", "User": "root"} +1 alter_type_owner {"EventType": "alter_type_owner", "Owner": "v", "Statement": "REASSIGN OWNED BY testuser TO v", "Tag": "REASSIGN OWNED BY", "TypeName": "ty", "User": "root"} +1 alter_type_owner {"EventType": "alter_type_owner", "Owner": "v", "Statement": "REASSIGN OWNED BY testuser TO v", "Tag": "REASSIGN OWNED BY", "TypeName": "_ty", "User": "root"} statement ok USE defaultdb @@ -886,7 +886,7 @@ SELECT "reportingID", "eventType", info::JSONB - 'Timestamp' - 'DescriptorID' WHERE "eventType" = 'create_type' AND info::JSONB->>'TypeName' LIKE '%eventlog' ORDER BY "timestamp", info ---- -1 create_type {"EventType": "create_type", "Statement": "CREATE TYPE defaultdb.public.eventlog AS ENUM ('event', 'log')", "TypeName": "defaultdb.public.eventlog", "User": "root"} +1 create_type {"EventType": "create_type", "Statement": "CREATE TYPE defaultdb.public.eventlog AS ENUM ('event', 'log')", "Tag": "CREATE TYPE", "TypeName": "defaultdb.public.eventlog", "User": "root"} statement ok ALTER TYPE eventlog ADD VALUE 'test' @@ -910,11 +910,11 @@ SELECT "reportingID", "eventType", info::JSONB - 'Timestamp' - 'DescriptorID' WHERE ("eventType" = 'alter_type' OR "eventType" = 'rename_type') AND info::JSONB->>'TypeName' LIKE '%eventlog%' ORDER BY "timestamp", info ---- -1 alter_type {"EventType": "alter_type", "Statement": "ALTER TYPE defaultdb.public.eventlog ADD VALUE 'test'", "TypeName": "defaultdb.public.eventlog", "User": "root"} -1 alter_type {"EventType": "alter_type", "Statement": "ALTER TYPE defaultdb.public.eventlog RENAME VALUE 'test' TO 'testing'", "TypeName": "defaultdb.public.eventlog", "User": "root"} -1 alter_type {"EventType": "alter_type", "Statement": "ALTER TYPE defaultdb.public.eventlog SET SCHEMA testing", "TypeName": "defaultdb.public.eventlog", "User": "root"} -1 alter_type {"EventType": "alter_type", "Statement": "ALTER TYPE defaultdb.testing.eventlog SET SCHEMA public", "TypeName": "defaultdb.testing.eventlog", "User": "root"} -1 rename_type {"EventType": "rename_type", "NewTypeName": "eventlog_renamed", "Statement": "ALTER TYPE defaultdb.public.eventlog RENAME TO eventlog_renamed", "TypeName": "defaultdb.public.eventlog", "User": "root"} +1 alter_type {"EventType": "alter_type", "Statement": "ALTER TYPE defaultdb.public.eventlog ADD VALUE 'test'", "Tag": "ALTER TYPE", "TypeName": "defaultdb.public.eventlog", "User": "root"} +1 alter_type {"EventType": "alter_type", "Statement": "ALTER TYPE defaultdb.public.eventlog RENAME VALUE 'test' TO 'testing'", "Tag": "ALTER TYPE", "TypeName": "defaultdb.public.eventlog", "User": "root"} +1 alter_type {"EventType": "alter_type", "Statement": "ALTER TYPE defaultdb.public.eventlog SET SCHEMA testing", "Tag": "ALTER TYPE", "TypeName": "defaultdb.public.eventlog", "User": "root"} +1 alter_type {"EventType": "alter_type", "Statement": "ALTER TYPE defaultdb.testing.eventlog SET SCHEMA public", "Tag": "ALTER TYPE", "TypeName": "defaultdb.testing.eventlog", "User": "root"} +1 rename_type {"EventType": "rename_type", "NewTypeName": "eventlog_renamed", "Statement": "ALTER TYPE defaultdb.public.eventlog RENAME TO eventlog_renamed", "Tag": "ALTER TYPE", "TypeName": "defaultdb.public.eventlog", "User": "root"} statement ok DROP TYPE eventlog_renamed @@ -925,8 +925,8 @@ SELECT "reportingID", "eventType", info::JSONB - 'Timestamp' - 'DescriptorID' WHERE "eventType" = 'drop_type' AND info::JSONB->>'TypeName' LIKE '%eventlog%' ORDER BY "timestamp", info ---- -1 drop_type {"EventType": "drop_type", "Statement": "DROP TYPE defaultdb.public.eventlog_renamed", "TypeName": "defaultdb.public.eventlog_renamed", "User": "root"} -1 drop_type {"EventType": "drop_type", "Statement": "DROP TYPE defaultdb.public.eventlog_renamed", "TypeName": "defaultdb.public._eventlog_renamed", "User": "root"} +1 drop_type {"EventType": "drop_type", "Statement": "DROP TYPE defaultdb.public.eventlog_renamed", "Tag": "DROP TYPE", "TypeName": "defaultdb.public.eventlog_renamed", "User": "root"} +1 drop_type {"EventType": "drop_type", "Statement": "DROP TYPE defaultdb.public.eventlog_renamed", "Tag": "DROP TYPE", "TypeName": "defaultdb.public._eventlog_renamed", "User": "root"} # Test the event logs generated by COMMENT ON ... commands. @@ -943,7 +943,7 @@ SELECT "reportingID", info::JSONB - 'Timestamp' - 'DescriptorID' FROM system.eventlog WHERE "eventType" = 'comment_on_column' ---- -1 {"ColumnName": "id", "Comment": "This is a column.", "EventType": "comment_on_column", "Statement": "COMMENT ON COLUMN a.id IS 'This is a column.'", "TableName": "defaultdb.public.a", "User": "root"} +1 {"ColumnName": "id", "Comment": "This is a column.", "EventType": "comment_on_column", "Statement": "COMMENT ON COLUMN a.id IS 'This is a column.'", "TableName": "defaultdb.public.a", "Tag": "COMMENT ON COLUMN", "User": "root"} statement ok CREATE INDEX b_index ON a (b) @@ -956,7 +956,7 @@ SELECT "reportingID", info::JSONB - 'Timestamp' - 'DescriptorID' FROM system.eventlog WHERE "eventType" = 'comment_on_index' ---- -1 {"Comment": "This is an index.", "EventType": "comment_on_index", "IndexName": "b_index", "Statement": "COMMENT ON INDEX defaultdb.public.a@b_index IS 'This is an index.'", "TableName": "defaultdb.public.a", "User": "root"} +1 {"Comment": "This is an index.", "EventType": "comment_on_index", "IndexName": "b_index", "Statement": "COMMENT ON INDEX defaultdb.public.a@b_index IS 'This is an index.'", "TableName": "defaultdb.public.a", "Tag": "COMMENT ON INDEX", "User": "root"} statement ok COMMENT ON TABLE a IS 'This is a table.' @@ -966,7 +966,7 @@ SELECT "reportingID", info::JSONB - 'Timestamp' - 'DescriptorID' FROM system.eventlog WHERE "eventType" = 'comment_on_table' ---- -1 {"Comment": "This is a table.", "EventType": "comment_on_table", "Statement": "COMMENT ON TABLE defaultdb.public.a IS 'This is a table.'", "TableName": "defaultdb.public.a", "User": "root"} +1 {"Comment": "This is a table.", "EventType": "comment_on_table", "Statement": "COMMENT ON TABLE defaultdb.public.a IS 'This is a table.'", "TableName": "defaultdb.public.a", "Tag": "COMMENT ON TABLE", "User": "root"} # Test the event logs generated by commands that set schemas. subtest set_schema @@ -995,11 +995,11 @@ FROM system.eventlog WHERE "eventType" = 'set_schema' ORDER BY "timestamp", info ---- -1 {"DescriptorName": "defaultdb.public.eventlog", "DescriptorType": "type", "EventType": "set_schema", "NewDescriptorName": "defaultdb.testing.eventlog", "Statement": "ALTER TYPE defaultdb.public.eventlog SET SCHEMA testing", "User": "root"} -1 {"DescriptorName": "defaultdb.testing.eventlog", "DescriptorType": "type", "EventType": "set_schema", "NewDescriptorName": "defaultdb.public.eventlog", "Statement": "ALTER TYPE defaultdb.testing.eventlog SET SCHEMA public", "User": "root"} -1 {"DescriptorName": "defaultdb.public.a", "DescriptorType": "table", "EventType": "set_schema", "NewDescriptorName": "defaultdb.testing.a", "Statement": "ALTER TABLE a SET SCHEMA testing", "User": "root"} -1 {"DescriptorName": "defaultdb.public.s", "DescriptorType": "sequence", "EventType": "set_schema", "NewDescriptorName": "defaultdb.testing.s", "Statement": "ALTER SEQUENCE s SET SCHEMA testing", "User": "root"} -1 {"DescriptorName": "defaultdb.public.v", "DescriptorType": "view", "EventType": "set_schema", "NewDescriptorName": "defaultdb.test_sc.v", "Statement": "ALTER VIEW v SET SCHEMA test_sc", "User": "root"} +1 {"DescriptorName": "defaultdb.public.eventlog", "DescriptorType": "type", "EventType": "set_schema", "NewDescriptorName": "defaultdb.testing.eventlog", "Statement": "ALTER TYPE defaultdb.public.eventlog SET SCHEMA testing", "Tag": "ALTER TYPE", "User": "root"} +1 {"DescriptorName": "defaultdb.testing.eventlog", "DescriptorType": "type", "EventType": "set_schema", "NewDescriptorName": "defaultdb.public.eventlog", "Statement": "ALTER TYPE defaultdb.testing.eventlog SET SCHEMA public", "Tag": "ALTER TYPE", "User": "root"} +1 {"DescriptorName": "defaultdb.public.a", "DescriptorType": "table", "EventType": "set_schema", "NewDescriptorName": "defaultdb.testing.a", "Statement": "ALTER TABLE a SET SCHEMA testing", "Tag": "ALTER TABLE SET SCHEMA", "User": "root"} +1 {"DescriptorName": "defaultdb.public.s", "DescriptorType": "sequence", "EventType": "set_schema", "NewDescriptorName": "defaultdb.testing.s", "Statement": "ALTER SEQUENCE s SET SCHEMA testing", "Tag": "ALTER TABLE SET SCHEMA", "User": "root"} +1 {"DescriptorName": "defaultdb.public.v", "DescriptorType": "view", "EventType": "set_schema", "NewDescriptorName": "defaultdb.test_sc.v", "Statement": "ALTER VIEW v SET SCHEMA test_sc", "Tag": "ALTER TABLE SET SCHEMA", "User": "root"} # Test the event logs generated by commands that drop views. @@ -1024,7 +1024,7 @@ WHERE "eventType" = 'drop_table' ORDER BY "timestamp" DESC, info LIMIT 1 ---- -1 {"CascadeDroppedViews": ["defaultdb.public.y", "defaultdb.public.z"], "EventType": "drop_table", "Statement": "DROP TABLE defaultdb.public.x CASCADE", "TableName": "defaultdb.public.x", "User": "root"} +1 {"CascadeDroppedViews": ["defaultdb.public.y", "defaultdb.public.z"], "EventType": "drop_table", "Statement": "DROP TABLE defaultdb.public.x CASCADE", "TableName": "defaultdb.public.x", "Tag": "DROP TABLE", "User": "root"} statement ok CREATE TABLE t (i INT PRIMARY KEY, INDEX (i)) @@ -1045,7 +1045,7 @@ WHERE "eventType" = 'drop_index' ORDER BY "timestamp" DESC, info LIMIT 1 ---- -1 {"EventType": "drop_index", "IndexName": "t_i_idx", "MutationID": 1, "Statement": "DROP INDEX defaultdb.public.t@t_i_idx CASCADE", "TableName": "defaultdb.public.t", "User": "root", "cascade_dropped_views": ["defaultdb.public.v", "defaultdb.public.w"]} +1 {"EventType": "drop_index", "IndexName": "t_i_idx", "MutationID": 1, "Statement": "DROP INDEX defaultdb.public.t@t_i_idx CASCADE", "TableName": "defaultdb.public.t", "Tag": "DROP INDEX", "User": "root", "cascade_dropped_views": ["defaultdb.public.v", "defaultdb.public.w"]} statement ok CREATE TABLE x (a INT PRIMARY KEY, b INT) @@ -1066,4 +1066,4 @@ WHERE "eventType" = 'alter_table' ORDER BY "timestamp" DESC, info LIMIT 1 ---- -1 {"CascadeDroppedViews": ["defaultdb.public.v", "defaultdb.public.vv"], "EventType": "alter_table", "MutationID": 1, "Statement": "ALTER TABLE defaultdb.public.x DROP COLUMN b CASCADE", "TableName": "defaultdb.public.x", "User": "root"} +1 {"CascadeDroppedViews": ["defaultdb.public.v", "defaultdb.public.vv"], "EventType": "alter_table", "MutationID": 1, "Statement": "ALTER TABLE defaultdb.public.x DROP COLUMN b CASCADE", "TableName": "defaultdb.public.x", "Tag": "ALTER TABLE", "User": "root"} diff --git a/pkg/util/log/eventpb/events.pb.go b/pkg/util/log/eventpb/events.pb.go index 200499fbb3ea..e4a7045bce09 100644 --- a/pkg/util/log/eventpb/events.pb.go +++ b/pkg/util/log/eventpb/events.pb.go @@ -67,6 +67,10 @@ var xxx_messageInfo_CommonEventDetails proto.InternalMessageInfo type CommonSQLEventDetails struct { // A normalized copy of the SQL statement that triggered the event. Statement string `protobuf:"bytes,1,opt,name=statement,proto3" json:",omitempty"` + // The statement tag. This is separate from the statement string, + // since the statement string can contain sensitive information. The + // tag is guaranteed not to. + Tag string `protobuf:"bytes,6,opt,name=tag,proto3" json:",omitempty" redact:"nonsensitive"` // The user account that triggered the event. User string `protobuf:"bytes,2,opt,name=user,proto3" json:",omitempty"` // The primary object descriptor affected by the operation. Set to zero for operations @@ -167,40 +171,39 @@ func init() { func init() { proto.RegisterFile("util/log/eventpb/events.proto", fileDescriptor_656955fd5b536468) } var fileDescriptor_656955fd5b536468 = []byte{ - // 513 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0x4f, 0x8b, 0xd3, 0x4e, - 0x1c, 0xc6, 0x9b, 0xed, 0xbf, 0x5f, 0xe7, 0xb7, 0x5d, 0x75, 0x70, 0x31, 0x14, 0x4c, 0x4a, 0x2e, - 0x56, 0x58, 0x5a, 0xd1, 0x93, 0x82, 0x08, 0xdd, 0xba, 0xd0, 0xa2, 0x82, 0xab, 0x78, 0xf0, 0x52, - 0x26, 0xc9, 0xd7, 0xec, 0xd4, 0x24, 0xdf, 0x21, 0x33, 0x2d, 0xf4, 0x2d, 0x78, 0xf2, 0x65, 0xf8, - 0x52, 0xf6, 0xb8, 0xc7, 0x3d, 0x05, 0x4d, 0x6f, 0x1e, 0x05, 0xef, 0x92, 0xa4, 0x66, 0xd3, 0x76, - 0x11, 0x3d, 0x25, 0x61, 0x3e, 0x4f, 0xe6, 0xf9, 0x3e, 0xcf, 0x0c, 0xb9, 0x3b, 0x57, 0xdc, 0x1f, - 0xf8, 0xe8, 0x0d, 0x60, 0x01, 0xa1, 0x12, 0x76, 0xfe, 0x94, 0x7d, 0x11, 0xa1, 0x42, 0xda, 0x71, - 0xd0, 0xf9, 0x18, 0x21, 0x73, 0xce, 0xfa, 0x29, 0xd8, 0xf7, 0xd1, 0xeb, 0xaf, 0xc1, 0xce, 0x6d, - 0x0f, 0x3d, 0xcc, 0xb0, 0x41, 0xfa, 0x96, 0x2b, 0x3a, 0xa6, 0x87, 0xe8, 0xf9, 0x30, 0xc8, 0xbe, - 0xec, 0xf9, 0x87, 0x81, 0xe2, 0x01, 0x48, 0xc5, 0x02, 0x91, 0x03, 0xd6, 0x27, 0x8d, 0xd0, 0x63, - 0x0c, 0x02, 0x0c, 0x9f, 0xa7, 0x3f, 0x1a, 0x81, 0x62, 0xdc, 0x97, 0xf4, 0x88, 0xb4, 0x0a, 0x52, - 0xd7, 0xba, 0x5a, 0xaf, 0x3a, 0x3c, 0xf8, 0x1e, 0x9b, 0xe4, 0x08, 0x03, 0xae, 0x20, 0x10, 0x6a, - 0x79, 0x7a, 0x05, 0xd0, 0x13, 0x42, 0x32, 0x1b, 0x53, 0xb5, 0x14, 0xa0, 0xef, 0x75, 0xb5, 0x5e, - 0x6b, 0x78, 0x6f, 0x13, 0xff, 0x11, 0x9b, 0x87, 0x11, 0xb8, 0xcc, 0x51, 0x4f, 0xac, 0x10, 0x43, - 0x09, 0xa1, 0xe4, 0x8a, 0x2f, 0xc0, 0x3a, 0x6d, 0x65, 0xd2, 0xb7, 0x4b, 0x01, 0xd6, 0x97, 0x3d, - 0x72, 0x98, 0x9b, 0x79, 0xf3, 0xfa, 0xc5, 0xb6, 0x1f, 0xa9, 0x98, 0x82, 0x00, 0x42, 0x95, 0xf9, - 0x69, 0xed, 0xfa, 0x29, 0x00, 0x6a, 0x91, 0xda, 0x5c, 0x42, 0xb4, 0x76, 0xb2, 0x0d, 0x66, 0x6b, - 0xf4, 0x98, 0xb4, 0x5d, 0x90, 0x4e, 0xc4, 0x85, 0xc2, 0x68, 0xca, 0x5d, 0xbd, 0xda, 0xd5, 0x7a, - 0xed, 0xa1, 0x91, 0xc4, 0xe6, 0xfe, 0xa8, 0x58, 0x18, 0x8f, 0xb6, 0xc4, 0xfb, 0x57, 0xa2, 0xb1, - 0x4b, 0x1f, 0x93, 0x9b, 0x4c, 0x08, 0x9f, 0x3b, 0x4c, 0x71, 0x0c, 0xa7, 0x21, 0x0b, 0x40, 0xaf, - 0x5d, 0xbb, 0xe9, 0x8d, 0x12, 0xf7, 0x8a, 0x05, 0x40, 0x9f, 0x12, 0x2a, 0x7c, 0xe6, 0xc0, 0x19, - 0xfa, 0x2e, 0x44, 0xd3, 0x05, 0xf3, 0xe7, 0x20, 0xf5, 0x7a, 0xb7, 0x7a, 0x8d, 0xf8, 0x56, 0x89, - 0x7c, 0x97, 0x81, 0xd6, 0xcf, 0x22, 0xaa, 0x09, 0xda, 0x1b, 0x51, 0xf5, 0x49, 0x63, 0x86, 0x76, - 0x3a, 0x51, 0xde, 0xdb, 0x9d, 0x24, 0x36, 0xeb, 0x13, 0xb4, 0x77, 0x46, 0xa9, 0xcf, 0xd0, 0x1e, - 0xbb, 0xf4, 0x25, 0xf9, 0x2f, 0xe5, 0x4b, 0xd5, 0x3d, 0x4c, 0x62, 0xb3, 0x39, 0x41, 0x3b, 0xed, - 0xe4, 0x6f, 0x5b, 0x6c, 0xce, 0x72, 0x9e, 0x3e, 0x20, 0xff, 0xff, 0x8e, 0x88, 0x63, 0x98, 0xa5, - 0xba, 0x3b, 0x50, 0x19, 0x29, 0xda, 0xaa, 0xfd, 0xa1, 0xad, 0x13, 0x72, 0xb0, 0xd1, 0x56, 0x9e, - 0x54, 0x7b, 0x68, 0x26, 0xb1, 0xd9, 0x2e, 0xd7, 0x25, 0xb7, 0xe4, 0xed, 0x72, 0x5f, 0x92, 0x3e, - 0x23, 0x8d, 0xf4, 0x98, 0xcc, 0xa5, 0xde, 0xf8, 0xb7, 0x53, 0xba, 0x96, 0x0d, 0xef, 0x9f, 0x7f, - 0x33, 0x2a, 0xe7, 0x89, 0xa1, 0x5d, 0x24, 0x86, 0x76, 0x99, 0x18, 0xda, 0xd7, 0xc4, 0xd0, 0x3e, - 0xaf, 0x8c, 0xca, 0xc5, 0xca, 0xa8, 0x5c, 0xae, 0x8c, 0xca, 0xfb, 0xe6, 0xfa, 0x46, 0xda, 0x8d, - 0xec, 0x86, 0x3d, 0xfa, 0x15, 0x00, 0x00, 0xff, 0xff, 0x9f, 0x8d, 0xa7, 0xc7, 0xd5, 0x03, 0x00, - 0x00, + // 511 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0x4f, 0x8b, 0xd3, 0x40, + 0x18, 0xc6, 0x9b, 0xed, 0x9f, 0xb5, 0xe3, 0x76, 0xd5, 0xc1, 0xc5, 0x50, 0x30, 0x29, 0xb9, 0x58, + 0x61, 0x69, 0x05, 0x4f, 0x2b, 0x88, 0x90, 0xad, 0x0b, 0x5d, 0x44, 0x70, 0x15, 0x0f, 0x5e, 0xca, + 0x24, 0x79, 0xcd, 0x4e, 0x4d, 0xf2, 0x0e, 0x99, 0x69, 0xa1, 0x5f, 0xc1, 0x93, 0x1f, 0x6b, 0x8f, + 0x7b, 0xdc, 0x53, 0xd0, 0xf4, 0xb6, 0x47, 0x3f, 0x81, 0x24, 0xa9, 0xd9, 0xb4, 0x5d, 0x84, 0xf5, + 0x94, 0x84, 0xf9, 0x3d, 0x99, 0xe7, 0x7d, 0x9e, 0x19, 0xf2, 0x74, 0xa6, 0x78, 0x30, 0x0c, 0xd0, + 0x1f, 0xc2, 0x1c, 0x22, 0x25, 0x9c, 0xe2, 0x29, 0x07, 0x22, 0x46, 0x85, 0xb4, 0xeb, 0xa2, 0xfb, + 0x2d, 0x46, 0xe6, 0x9e, 0x0f, 0x32, 0x70, 0x10, 0xa0, 0x3f, 0x58, 0x81, 0xdd, 0xc7, 0x3e, 0xfa, + 0x98, 0x63, 0xc3, 0xec, 0xad, 0x50, 0x74, 0x4d, 0x1f, 0xd1, 0x0f, 0x60, 0x98, 0x7f, 0x39, 0xb3, + 0xaf, 0x43, 0xc5, 0x43, 0x90, 0x8a, 0x85, 0xa2, 0x00, 0xac, 0xef, 0x1a, 0xa1, 0xc7, 0x18, 0x86, + 0x18, 0xbd, 0xcd, 0x7e, 0x34, 0x02, 0xc5, 0x78, 0x20, 0xe9, 0x21, 0x69, 0x97, 0xa4, 0xae, 0xf5, + 0xb4, 0x7e, 0xdd, 0xde, 0xbf, 0x4e, 0x4c, 0x72, 0x88, 0x21, 0x57, 0x10, 0x0a, 0xb5, 0x38, 0xbb, + 0x01, 0xe8, 0x09, 0x21, 0xb9, 0x8d, 0x89, 0x5a, 0x08, 0xd0, 0x77, 0x7a, 0x5a, 0xbf, 0x6d, 0x3f, + 0x5b, 0xc7, 0x7f, 0x27, 0xe6, 0x41, 0x0c, 0x1e, 0x73, 0xd5, 0x2b, 0x2b, 0xc2, 0x48, 0x42, 0x24, + 0xb9, 0xe2, 0x73, 0xb0, 0xce, 0xda, 0xb9, 0xf4, 0xd3, 0x42, 0x80, 0xb5, 0xdc, 0x21, 0x07, 0x85, + 0x99, 0x8f, 0x1f, 0xde, 0x6d, 0xfa, 0x91, 0x8a, 0x29, 0x08, 0x21, 0x52, 0xb9, 0x9f, 0xf6, 0xb6, + 0x9f, 0x12, 0xa0, 0x47, 0xa4, 0xae, 0x98, 0xaf, 0xb7, 0xee, 0x66, 0x24, 0xd3, 0x50, 0x8b, 0x34, + 0x66, 0x12, 0xe2, 0xd5, 0x10, 0x9b, 0x7b, 0xe4, 0x6b, 0xf4, 0x98, 0x74, 0x3c, 0x90, 0x6e, 0xcc, + 0x85, 0xc2, 0x78, 0xc2, 0x3d, 0xbd, 0xde, 0xd3, 0xfa, 0x1d, 0xdb, 0x48, 0x13, 0x73, 0x6f, 0x54, + 0x2e, 0x8c, 0x47, 0x1b, 0xe2, 0xbd, 0x1b, 0xd1, 0xd8, 0xa3, 0x47, 0xe4, 0x21, 0x13, 0x22, 0xe0, + 0x2e, 0x53, 0x1c, 0xa3, 0x49, 0xc4, 0x42, 0xd0, 0x1b, 0xb7, 0x6e, 0xfa, 0xa0, 0xc2, 0xbd, 0x67, + 0x21, 0xd0, 0xd7, 0x84, 0x8a, 0x80, 0xb9, 0x70, 0x8e, 0x81, 0x07, 0xf1, 0x64, 0xce, 0x82, 0x19, + 0x48, 0xbd, 0xd9, 0xab, 0xdf, 0x22, 0x7e, 0x54, 0x21, 0x3f, 0xe7, 0xa0, 0x75, 0x5d, 0xa6, 0x7c, + 0x8a, 0xce, 0x5a, 0xca, 0x03, 0xd2, 0x9a, 0xa2, 0x93, 0x4d, 0x54, 0x54, 0xfe, 0x24, 0x4d, 0xcc, + 0xe6, 0x29, 0x3a, 0x5b, 0xa3, 0x34, 0xa7, 0xe8, 0x8c, 0x3d, 0x6a, 0x93, 0x7b, 0x19, 0xff, 0x3f, + 0xad, 0xef, 0x4e, 0xd1, 0xc9, 0x3a, 0xa7, 0x2f, 0xc8, 0xfd, 0xbf, 0xb9, 0x70, 0x8c, 0xf2, 0x28, + 0xb7, 0xa7, 0xa8, 0x22, 0x65, 0x45, 0x8d, 0x7f, 0x54, 0x74, 0x42, 0xf6, 0xd7, 0x2a, 0x2a, 0xe2, + 0xe9, 0xd8, 0x66, 0x9a, 0x98, 0x9d, 0x6a, 0x47, 0x72, 0x43, 0xde, 0xa9, 0x96, 0x24, 0xe9, 0x1b, + 0xd2, 0xca, 0x8e, 0xd5, 0x4c, 0xde, 0xf5, 0x30, 0xad, 0x64, 0xf6, 0xf3, 0x8b, 0x5f, 0x46, 0xed, + 0x22, 0x35, 0xb4, 0xcb, 0xd4, 0xd0, 0xae, 0x52, 0x43, 0xfb, 0x99, 0x1a, 0xda, 0x8f, 0xa5, 0x51, + 0xbb, 0x5c, 0x1a, 0xb5, 0xab, 0xa5, 0x51, 0xfb, 0xb2, 0xbb, 0xba, 0xc1, 0x4e, 0x2b, 0xbf, 0x91, + 0x2f, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0x01, 0xc0, 0x2d, 0x84, 0x05, 0x04, 0x00, 0x00, } func (m *CommonEventDetails) Marshal() (dAtA []byte, err error) { @@ -258,6 +261,13 @@ func (m *CommonSQLEventDetails) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Tag) > 0 { + i -= len(m.Tag) + copy(dAtA[i:], m.Tag) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Tag))) + i-- + dAtA[i] = 0x32 + } if len(m.PlaceholderValues) > 0 { for iNdEx := len(m.PlaceholderValues) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.PlaceholderValues[iNdEx]) @@ -424,6 +434,10 @@ func (m *CommonSQLEventDetails) Size() (n int) { n += 1 + l + sovEvents(uint64(l)) } } + l = len(m.Tag) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } return n } @@ -745,6 +759,38 @@ func (m *CommonSQLEventDetails) Unmarshal(dAtA []byte) error { } m.PlaceholderValues = append(m.PlaceholderValues, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tag", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Tag = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEvents(dAtA[iNdEx:]) diff --git a/pkg/util/log/eventpb/events.proto b/pkg/util/log/eventpb/events.proto index 3b4afd6fe98b..292c74bf8903 100644 --- a/pkg/util/log/eventpb/events.proto +++ b/pkg/util/log/eventpb/events.proto @@ -37,6 +37,11 @@ message CommonSQLEventDetails { // A normalized copy of the SQL statement that triggered the event. string statement = 1 [(gogoproto.jsontag) = ",omitempty"]; + // The statement tag. This is separate from the statement string, + // since the statement string can contain sensitive information. The + // tag is guaranteed not to. + string tag = 6 [(gogoproto.jsontag) = ",omitempty", (gogoproto.moretags) = "redact:\"nonsensitive\""]; + // The user account that triggered the event. string user = 2 [(gogoproto.jsontag) = ",omitempty"]; @@ -59,7 +64,7 @@ message CommonJobEventDetails { int64 job_id = 1 [(gogoproto.customname) = "JobID", (gogoproto.jsontag) = ",omitempty"]; // The type of the job that triggered the event. - string job_type = 2 [(gogoproto.customname) = "JobType", (gogoproto.jsontag) = ",omitempty", (gogoproto.moretags) = "redact:\"nonsensitive\""]; + string job_type = 2 [(gogoproto.jsontag) = ",omitempty", (gogoproto.moretags) = "redact:\"nonsensitive\""]; // A description of the job that triggered the event. Some jobs populate the // description with an approximate representation of the SQL statement run to diff --git a/pkg/util/log/eventpb/json_encode_generated.go b/pkg/util/log/eventpb/json_encode_generated.go index be862364db9e..0d13814ad3e5 100644 --- a/pkg/util/log/eventpb/json_encode_generated.go +++ b/pkg/util/log/eventpb/json_encode_generated.go @@ -1142,6 +1142,16 @@ func (m *CommonSQLEventDetails) AppendJSONFields(printComma bool, b redact.Redac b = append(b, '"') } + if m.Tag != "" { + if printComma { + b = append(b, ',') + } + printComma = true + b = append(b, "\"Tag\":\""...) + b = redact.RedactableBytes(jsonbytes.EncodeString([]byte(b), m.Tag)) + b = append(b, '"') + } + if m.User != "" { if printComma { b = append(b, ',')