]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
files: only call loggers is there is work to do
authorVictor Julien <vjulien@oisf.net>
Wed, 21 Sep 2022 07:34:08 +0000 (09:34 +0200)
committerVictor Julien <vjulien@oisf.net>
Sat, 1 Oct 2022 18:27:38 +0000 (20:27 +0200)
src/output-tx.c

index 3b4e55a6ed07f8393fdaeebe7e1a76b81ef9809b..708c449a7c19fc98cceededbda08b1c786120efa 100644 (file)
@@ -189,10 +189,10 @@ static inline void OutputTxLogFiles(ThreadVars *tv, OutputFileLoggerThreadData *
         const bool file_trunc = StreamTcpReassembleDepthReached(p) | eof;
         SCLogDebug("tx: calling files: ffc %p head %p file_close %d file_trunc %d", ffc, ffc->head,
                 file_close, file_trunc);
-        if (filedata_td)
+        if (filedata_td && txd->files_opened > txd->files_stored)
             OutputFiledataLogFfc(tv, filedata_td, p, ffc, tx, tx_id, txd, packet_dir, file_close,
                     file_trunc, packet_dir);
-        if (file_td)
+        if (file_td && txd->files_opened > txd->files_logged)
             OutputFileLogFfc(
                     tv, file_td, p, ffc, tx, tx_id, txd, file_close, file_trunc, packet_dir);
     }
@@ -203,10 +203,10 @@ static inline void OutputTxLogFiles(ThreadVars *tv, OutputFileLoggerThreadData *
         opposing_finished = true;
         SCLogDebug("tx: calling for opposing direction files: file_close:%s file_trunc:%s",
                 file_close ? "true" : "false", file_trunc ? "true" : "false");
-        if (filedata_td)
+        if (filedata_td && txd->files_opened > txd->files_stored)
             OutputFiledataLogFfc(tv, filedata_td, p, ffc_opposing, tx, tx_id, txd, opposing_dir,
                     file_close, file_trunc, opposing_dir);
-        if (file_td)
+        if (file_td && txd->files_opened > txd->files_logged)
             OutputFileLogFfc(tv, file_td, p, ffc_opposing, tx, tx_id, txd, file_close, file_trunc,
                     opposing_dir);
     }