diff --git a/etc/schema.json b/etc/schema.json index 51b561884791..ed6b76c12c7a 100644 --- a/etc/schema.json +++ b/etc/schema.json @@ -2387,9 +2387,6 @@ "type": "object", "optional": true, "properties": { - "tx_id": { - "type": "integer" - }, "version": { "type": "string" }, @@ -2402,8 +2399,14 @@ "affected_rows": { "type": "integer" }, - }, - "additionalProperties": false + "rows": { + "type": "array", + "optional": true, + "items": { + "type": "string" + } + } + } }, "ldap": { "type": "object", @@ -4685,6 +4688,10 @@ "description": "Errors encountered parsing MQTT protocol", "$ref": "#/$defs/stats_applayer_error" }, + "mysql": { + "description": "Errors encountered parsing MySQL protocol", + "$ref": "#/$defs/stats_applayer_error" + }, "nfs_tcp": { "description": "Errors encountered parsing NFS/TCP protocol", "$ref": "#/$defs/stats_applayer_error" @@ -4860,6 +4867,10 @@ "description": "Number of flows for MQTT protocol", "type": "integer" }, + "mysql": { + "description": "Number of flows for MySQL protocol", + "type": "integer" + }, "nfs_tcp": { "description": "Number of flows for NFS/TCP protocol", "type": "integer" @@ -5030,6 +5041,10 @@ "description": "Number of transactions for MQTT protocol", "type": "integer" }, + "mysql": { + "description": "Number of flows for MySQL protocol", + "type": "integer" + }, "nfs_tcp": { "description": "Number of transactions for NFS/TCP protocol", "type": "integer" diff --git a/rust/src/mysql/logger.rs b/rust/src/mysql/logger.rs index 6bc68c180581..74ee844c2bb1 100644 --- a/rust/src/mysql/logger.rs +++ b/rust/src/mysql/logger.rs @@ -20,7 +20,7 @@ use crate::jsonbuilder::{JsonBuilder, JsonError}; use crate::mysql::mysql::*; -fn log_mysql(tx: &MysqlTransaction, _flags: u32, js: &mut JsonBuilder) -> Result<(), JsonError> { +fn log_mysql(tx: &MysqlTransaction, js: &mut JsonBuilder) -> Result<(), JsonError> { js.open_object("mysql")?; if let Some(version) = &tx.version { js.set_string("version", version)?; @@ -54,14 +54,14 @@ fn log_mysql(tx: &MysqlTransaction, _flags: u32, js: &mut JsonBuilder) -> Result #[no_mangle] pub unsafe extern "C" fn SCMysqlLogger( - tx: *mut std::os::raw::c_void, flags: u32, js: &mut JsonBuilder, + tx: *mut std::os::raw::c_void, js: &mut JsonBuilder, ) -> bool { let tx_mysql = cast_pointer!(tx, MysqlTransaction); SCLogDebug!( "----------- MySQL rs_mysql_logger call. Tx is {:?}", tx_mysql ); - let result = log_mysql(tx_mysql, flags, js); + let result = log_mysql(tx_mysql, js); if let Err(ref err) = result { SCLogError!("----------- MySQL rs_mysql_logger failed. err is {:?}", err); } diff --git a/src/output.c b/src/output.c index cca55baf0c34..44f0e6074e01 100644 --- a/src/output.c +++ b/src/output.c @@ -902,7 +902,7 @@ void OutputRegisterRootLoggers(void) RegisterSimpleJsonApplayerLogger( ALPROTO_BITTORRENT_DHT, rs_bittorrent_dht_logger_log, "bittorrent_dht"); RegisterSimpleJsonApplayerLogger( - ALPROTO_MYSQL, (EveJsonSimpleTxLogFunc)SCMysqlLogger, "mysql"); + ALPROTO_MYSQL, SCMysqlLogger, "mysql"); OutputPacketLoggerRegister(); OutputFiledataLoggerRegister(); @@ -1083,6 +1083,10 @@ void OutputRegisterLoggers(void) OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonLdapLog", "eve-log.ldap", OutputJsonLogInitSub, ALPROTO_LDAP, JsonGenericDirFlowLogger, JsonLogThreadInit, JsonLogThreadDeinit); + /* MySQL JSON logger. */ + OutputRegisterTxSubModule(LOGGER_JSON_TX, "eve-log", "JsonMySQLLog", "eve-log.mysql", + OutputJsonLogInitSub, ALPROTO_MYSQL, JsonGenericDirFlowLogger, JsonLogThreadInit, + JsonLogThreadDeinit); /* DoH2 JSON logger. */ JsonDoh2LogRegister(); /* Template JSON logger. */