typedef enum LogModeConditionalType_ {
LOGMODE_COND_ALL,
- LOGMODE_COND_ALERTS
+ LOGMODE_COND_ALERTS,
+ LOGMODE_COND_TAG
} LogModeConditionalType;
#define RING_BUFFER_MODE_DISABLED 0
if (p->flags & PKT_PSEUDO_STREAM_END) {
return FALSE;
}
- /* Log alerted flow */
- if (ptd->pcap_log->conditional == LOGMODE_COND_ALERTS) {
- if (p->alerts.cnt || (p->flow && FlowHasAlerts(p->flow))) {
- return TRUE;
- } else {
- return FALSE;
- }
+
+ /* Log alerted flow or tagged flow */
+ switch (ptd->pcap_log->conditional) {
+ case LOGMODE_COND_ALL:
+ break;
+ case LOGMODE_COND_ALERTS:
+ if (p->alerts.cnt || (p->flow && FlowHasAlerts(p->flow))) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+ break;
+ case LOGMODE_COND_TAG:
+ if (p->flags & PKT_HAS_TAG) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+ break;
}
if (IS_TUNNEL_PKT(p) && !IS_TUNNEL_ROOT_PKT(p)) {
/* if we are using alerted logging and if packet is first one with alert in flow
* then we need to dump in the pcap the stream acked by the packet */
- if ((p->flags & PKT_FIRST_ALERTS) && (td->pcap_log->conditional == LOGMODE_COND_ALERTS)) {
+ if ((p->flags & PKT_FIRST_ALERTS) && (td->pcap_log->conditional != LOGMODE_COND_ALL)) {
if (PKT_IS_TCP(p)) {
/* dump fake packets for all segments we have on acked by packet */
#ifdef HAVE_LIBLZ4
if (strcasecmp(s_conditional, "alerts") == 0) {
pl->conditional = LOGMODE_COND_ALERTS;
EnableTcpSessionDumping();
+ } else if (strcasecmp(s_conditional, "tag") == 0) {
+ pl->conditional = LOGMODE_COND_TAG;
+ EnableTcpSessionDumping();
} else if (strcasecmp(s_conditional, "all") != 0) {
FatalError(SC_ERR_INVALID_ARGUMENT,
"log-pcap: invalid conditional \"%s\". Valid options: \"all\", "
- "or \"alerts\" mode ",
+ "\"alerts\", or \"tag\" mode ",
s_conditional);
}
}
#ts-format: usec # sec or usec second format (default) is filename.sec usec is filename.sec.usec
use-stream-depth: no #If set to "yes" packets seen after reaching stream inspection depth are ignored. "no" logs all packets
honor-pass-rules: no # If set to "yes", flows in which a pass rule matched will stop being logged.
- # Use "all" to log all packets or use "alerts" to log only alerted packets and flows
+ # Use "all" to log all packets or use "alerts" to log only alerted packets and flows or "tag"
+ # to log only flow tagged via the "tag" keyword
#conditional: all
# a full alert log containing much information for signature writers