toserver-groups: 25
sgh-mpm-context: auto
inspection-recursion-limit: 3000
+ stream-tx-log-limit: 4
At all of these options, you can add (or change) a value. Most
signatures have the adjustment to focus on one direction, meaning
meaning it will repeat its actions over and over again. With the
option inspection-recursion-limit you can limit this action.
+The stream-tx-log-limit defines the maximum number of times a
+transaction will get logged for a stream-only rule match.
+This is meant to avoid logging the same data an arbitrary number
+of times.
+
*Example 4 Detection-engine grouping tree*
.. image:: suricata-yaml/grouping_tree.png
/// STREAM_TOCLIENT: file tx , files only in toclient dir
/// STREAM_TOSERVER|STREAM_TOCLIENT: files possible in both dirs
pub file_tx: u8,
+ /// Number of times this tx data has already been logged for one stream match
+ pub stream_logged: u8,
/// detection engine flags for use by detection engine
detect_flags_ts: u64,
files_stored: 0,
file_flags: 0,
file_tx: 0,
+ stream_logged: 0,
detect_flags_ts: 0,
detect_flags_tc: 0,
de_state: std::ptr::null_mut(),
files_stored: 0,
file_flags: 0,
file_tx: 0,
+ stream_logged: 0,
detect_flags_ts,
detect_flags_tc,
de_state: std::ptr::null_mut(),
SCLogDebug("de_ctx->inspection_recursion_limit: %d",
de_ctx->inspection_recursion_limit);
+ // default value is 4
+ de_ctx->stream_tx_log_limit = 4;
+ if (ConfGetInt("detect.stream-tx-log-limit", &value) == 1) {
+ if (value >= 0 && value <= UINT8_MAX) {
+ de_ctx->stream_tx_log_limit = (uint8_t)value;
+ } else {
+ SCLogWarning("Invalid value for detect-engine.stream-tx-log-limit: must be between 0 "
+ "and 255, will default to 4");
+ }
+ }
+
/* parse port grouping whitelisting settings */
const char *ports = NULL;
#include "suricata-common.h"
#include "suricata.h"
-#include "conf.h"
#include "decode.h"
#include "packet.h"
uint8_t dir =
(p->flowflags & FLOW_PKT_TOCLIENT) ? STREAM_TOCLIENT : STREAM_TOSERVER;
txid = AppLayerParserGetTransactionInspectId(pflow->alparser, dir);
- alert_flags |= PACKET_ALERT_FLAG_TX;
+ void *tx_ptr =
+ AppLayerParserGetTx(pflow->proto, pflow->alproto, pflow->alstate, txid);
+ AppLayerTxData *txd =
+ tx_ptr ? AppLayerParserGetTxData(pflow->proto, pflow->alproto, tx_ptr)
+ : NULL;
+ if (txd && txd->stream_logged < de_ctx->stream_tx_log_limit) {
+ alert_flags |= PACKET_ALERT_FLAG_TX;
+ txd->stream_logged++;
+ }
}
}
AlertQueueAppend(det_ctx, s, p, txid, alert_flags);
/* maximum recursion depth for content inspection */
int inspection_recursion_limit;
+ /* maximum number of times a tx will get logged for a stream-only rule match */
+ uint8_t stream_tx_log_limit;
+
/* registration id for per thread ctx for the filemagic/file.magic keywords */
int filemagic_thread_ctx_id;
toserver-groups: 25
sgh-mpm-context: auto
inspection-recursion-limit: 3000
+ # maximum number of times a tx will get logged for a stream-only rule match
+ # stream-tx-log-limit: 4
# If set to yes, the loading of signatures will be made after the capture
# is started. This will limit the downtime in IPS mode.
#delayed-detect: yes