@@ -80,7 +80,8 @@ Syntax::
80
80
81
81
dataset:<set|unset|isset|isnotset>,<name> \
82
82
[, type <string|md5|sha256|ipv4|ip>, save <file name>, load <file name>, state <file name>, memcap <size>, hashsize <size>
83
- , format <csv|json|jsonline>, enrichment_key <output_key>, value_key <json_key>, array_key <json_path>];
83
+ , format <csv|json|jsonline>, enrichment_key <output_key>, value_key <json_key>, array_key <json_path>,
84
+ remove_key];
84
85
85
86
type <type>
86
87
the data type: string, md5, sha256, ipv4, ip
@@ -108,6 +109,9 @@ value_key <key>
108
109
array_key <key>
109
110
the key to use for the array of the alert
110
111
for json format
112
+ remove_key
113
+ if set, the JSON object pointed by value key will be removed
114
+ from the alert event
111
115
112
116
113
117
.. note :: 'type' is mandatory and needs to be set.
@@ -161,7 +165,7 @@ The rules will only match if the data is in the list and the reputation
161
165
value is higher than 200.
162
166
163
167
164
- .. _ datasets_datajson :
168
+ .. _ datasets_json :
165
169
166
170
dataset with json
167
171
~~~~~~~~~~~~~~~~~
@@ -188,12 +192,17 @@ Example rules could look like::
188
192
189
193
In this example, the match will occur if the destination IP is in the set and the
190
194
alert will have an ``alert.extra.bad_ones `` subobject that will contain the JSON
191
- data associated to the value.
195
+ data associated to the value (`` bad_ones `` coming from `` enrichment_key `` option) .
192
196
193
- If ``json_key `` is present then the data file has to contains a valid JSON object containing an array
194
- where every elemeents have to contain a key equal to ``json_key ``.
197
+ When format is ``json `` or ``jsonline ``, the ``value_key `` is used to get
198
+ the value in the line (``jsonline `` format) or in the array (``json `` format).
199
+ At least one single element needs to be have the ``value_key `` present in the data file to
200
+ have a successful load.
195
201
If ``array_key `` is present, Suricata will extract the corresponding subobject that has to be
196
- a JSON array. This is only valid for ``json `` format.
202
+ a JSON array and search for element to add to the set in this array. This is only valid for ``json `` format.
203
+
204
+ If you don't want to have the ``value_key `` in the alert, you can use the
205
+ ``remove_key `` option. This will remove the key from the alert event.
197
206
198
207
See :ref: `Datajson format <datajson_data >` for more information.
199
208
0 commit comments