eve: add rule generation source to alert record

When an alert is generated from firewall context, add an engine value of
"fw", otherwise "td" (for threat detect).

The engine field is only added when firewall mode is enabled.

Ticket: #8456
(cherry picked from commit 029fd1be59)
pull/15385/head
Jason Ish 1 week ago
parent 69e829b082
commit 1a09a059dc

@ -405,6 +405,10 @@ It can also contain information about Source and Target of the attack in the
``alert.source`` and ``alert.target`` field if target keyword is used in
the signature.
In firewall mode, the ``alert.engine`` field identifies which rule engine
generated the alert: ``fw`` for firewall rules and ``td`` for threat detect
rules. This field is omitted outside of firewall mode.
This event will also have the ``pcap_cnt`` field, when running in pcap mode, to
indicate which packet triggered the signature.

@ -21,6 +21,14 @@
"additionalProperties": true,
"description": "Extra context data created by keywords such as dataset with JSON"
},
"engine": {
"type": "string",
"enum": [
"fw",
"td"
],
"description": "Engine that generated the alert in firewall mode: fw for firewall rules, td for threat detect rules."
},
"gid": {
"type": "integer"
},

@ -228,6 +228,9 @@ void AlertJsonHeader(const Packet *p, const PacketAlert *pa, SCJsonBuilder *js,
SCJbOpenObject(js, "alert");
SCJbSetString(js, "action", action);
if (EngineModeIsFirewall()) {
SCJbSetString(js, "engine", (pa->s->flags & SIG_FLAG_FIREWALL) ? "fw" : "td");
}
SCJbSetUint(js, "gid", pa->s->gid);
SCJbSetUint(js, "signature_id", pa->s->id);
SCJbSetUint(js, "rev", pa->s->rev);

Loading…
Cancel
Save