]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
pgsql/logger: don't log empty transactions
authorJuliana Fajardini <jufajardini@gmail.com>
Mon, 17 Feb 2025 19:50:38 +0000 (16:50 -0300)
committerVictor Julien <victor@inliniac.net>
Wed, 19 Feb 2025 08:21:37 +0000 (09:21 +0100)
This may happen in some situations if the app-layer parser only sees
unknown messages and sets an event: there will be an empty transaction,
but nothing to log.

Related to
Task #5566

rust/src/pgsql/logger.rs

index 9d78ffdc318e2d702c79180459c36c47b122f685..edf87e4ec4bbc7431029b1bd7a0d924951429feb 100644 (file)
@@ -33,9 +33,8 @@ fn log_pgsql(tx: &PgsqlTransaction, flags: u32, js: &mut JsonBuilder) -> Result<
         js.set_object("request", &log_request(request, flags)?)?;
     } else if tx.responses.is_empty() {
         SCLogDebug!("Suricata created an empty PGSQL transaction");
-        // TODO Log anomaly event instead?
-        js.set_bool("request", false)?;
-        js.set_bool("response", false)?;
+        // TODO Log anomaly event?
+        // if there are no transactions, there's nothing more to be logged
         js.close()?;
         return Ok(());
     }