Using the ``dataset`` and ``datarep`` keyword it is possible to match on
large amounts of data against any sticky buffer.
Using the ``dataset`` and ``datarep`` keyword it is possible
to match on large amounts of data against any sticky buffer.
For example, to match against a DNS black list called ``dns-bl``::
@ -79,7 +79,8 @@ Syntax::
dataset:<cmd>,<name>,<options>;
dataset:<set|unset|isset|isnotset>,<name> \
[, type <string|md5|sha256|ipv4|ip>, save <file name>, load <file name>, state <file name>, memcap <size>, hashsize <size>];
[, type <string|md5|sha256|ipv4|ip>, save <file name>, load <file name>, state <file name>, memcap <size>, hashsize <size>
, format <csv|json>, enrichment_key <output_key>, value_key <json_key>, array_key <json_path>];
type <type>
the data type: string, md5, sha256, ipv4, ip
@ -94,6 +95,20 @@ memcap <size>
maximum memory limit for the respective dataset
hashsize <size>
allowed size of the hash for the respective dataset
format <type>
the format of the file: csv, json. Defaut to csv. See
:ref:`dataset with json format <datasets_json>` for json
option
enrichment_key <key>
the key to use for the enrichment of the alert event
for json format
value_key <key>
the key to use for the value of the alert
for json format
array_key <key>
the key to use for the array of the alert
for json format
..note:: 'type' is mandatory and needs to be set.
@ -146,6 +161,37 @@ The rules will only match if the data is in the list and the reputation
value is higher than 200.
.._datasets_datajson:
dataset with json
~~~~~~~~~~~~~~~~~
DataJSON allows matching data against a set and output data attached to the matching
value in the event.
Syntax::
dataset:<cmd>,<name>,<options>;
dataset:<isset|isnotset>,<name> \
[, type <string|md5|sha256|ipv4|ip>, load <file name>, format json, memcap <size>, hashsize <size>, enrichment_key <json_key> \
, value_key <json_key>, array_key <json_path>];
Example rules could look like::
alert http any any -> any any (msg:"IP match"; ip.dst; dataset:isset,bad_ips, type ip, load bad_ips.json, format json, enrichment_key bad_ones, value_key ip; sid:8000001;)
In this example, the match will occur if the destination IP is in the set and the
alert will have an ``alert.extra.bad_ones`` subobject that will contain the JSON
data associated to the value.
If ``json_key`` is present then the data file has to contains a valid JSON object containing an array
where every elemeents have to contain a key equal to ``json_key``.
If ``array_key`` is present, Suricata will extract the corresponding subobject that has to be
a JSON array.
See :ref:`Datajson format <datajson_data>` for more information.
Rule Reloads
------------
@ -243,6 +289,28 @@ Syntax::
dataset-dump
dataset-add-json
~~~~~~~~~~~~~~~~
Unix Socket command to add data to a set. On success, the addition becomes