Skip to content

Commit

Permalink
docs: basic datajson documentation
Browse files Browse the repository at this point in the history
Ticket: OISF#7372
  • Loading branch information
regit committed Nov 7, 2024
1 parent 997805d commit a67bd9b
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions doc/userguide/rules/datasets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Datasets
========

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`` and ``datajson`` 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``::

Expand Down Expand Up @@ -145,6 +145,26 @@ reputation lists. A MD5 list, a SHA256 list, and a raw string (buffer) list.
The rules will only match if the data is in the list and the reputation
value is higher than 200.

datajson
~~~~~~~~

DataJSON allows matching data against a set and output data attached to the matching
value in the event.

Syntax::

datajson:<cmd>,<name>,<options>;

datajson:<isset|isnotset>,<name> \
[, type <string|md5|sha256|ipv4|ip>, load <file name>, memcap <size>, hashsize <size>, key <json_key>];

Example rules could look like::

alert http any any -> any any (msg:"IP match"; ip.dst; datajson:isset,bad_ips, type ip, load bad_ips.csv, key bad_ones; 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.

Rule Reloads
------------
Expand Down Expand Up @@ -292,6 +312,17 @@ Syntax::

<data>,<value>


datajson
~~~~~~~~

The datajson format follows the dataset, expect that there are 1 more CSV
field:

Syntax::

<data>,<json_data>

.. _datasets_file_locations:

File Locations
Expand Down

0 comments on commit a67bd9b

Please sign in to comment.