Skip to content

Commit 60b3186

Browse files
committed
Unirec output plugin: updated README
1 parent 544f64f commit 60b3186

File tree

1 file changed

+39
-18
lines changed

1 file changed

+39
-18
lines changed

extra_plugins/output/unirec/README.rst

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ UniRec (output plugin)
22
======================
33

44
The plugin converts IPFIX flow records into UniRec format and sends them as UniRec records via
5-
a TRAP output interface. Structure of the output record is defined using an UniRec template that
5+
a TRAP output interface. Structure of the output record is defined using a UniRec template that
66
consists of one or more UniRec fields.
77

88
Each flow record is converted individually. For each IPFIX field the plugin tries to find mapping
99
to a particular UniRec field of the output record and performs data conversion. It is possible
10-
that the original IPFIX record doesn't contain of all required fields. In this case, a user could
10+
that the original IPFIX record doesn't contain all required fields. In this case, a user could
1111
choose to drop the whole record or fill undefined UniRec fields with default values.
1212
Converted records are sent over a unix socket/tcp/tcp-tls for further processing or stored as
1313
files.
1414

1515
An instance of the plugin can use only one TRAP output interface and one UniRec template at the
1616
same time. However, it is possible to create multiple instances of this plugin with different
17-
configuration. For example, one instance can convert all flows using an UniRec template that
17+
configuration. For example, one instance can convert all flows using a UniRec template that
1818
consists of common fields available in all flow records and another instance converts only
1919
flow records that consist of HTTP fields.
2020

@@ -89,7 +89,7 @@ Parameters
8989
a flow record to convert doesn't contain all mandatory fields, it is dropped.
9090
However, UniRec fields that start with '?' are optional and if they are not present in the
9191
record (e.g. TCP_FLAGS) default value (typically zero) is used. List of all supported UniRec
92-
fields is defined in `unirec-element.txt <unirec-elements.txt>`_ file.
92+
fields is defined in `unirec-element.txt <config/unirec-elements.txt>`_ file.
9393
Example value: "DST_IP,SRC_IP,BYTES,DST_PORT,?TCP_FLAGS,SRC_PORT,PROTOCOL".
9494

9595
:``trapIfcCommon``:
@@ -199,34 +199,55 @@ UniRec configuration file
199199
-------------------------
200200

201201
Conversion from IPFIX fields to UniRec fields is defined in the configuration file
202-
`unirec-element.txt <unirec-elements.txt>`_. The file is distributed and installed together
202+
`unirec-element.txt <config/unirec-elements.txt>`_. The file is distributed and installed together
203203
with the plugin and it is usually placed in the same directory as the default IPFIXcol startup
204204
configuration (see ``ipfixcol2 -h`` for help).
205205

206206
The structure of the file is simple. Every line corresponds to one UniRec field and consists of
207-
four mandatory columns (name, type, IPFIX IEs, description). For example,
208-
a line: ``"BYTES uint64 e0id1 Number of bytes in flow"``:
207+
three mandatory parameters (name, type, list of IPFIX Information Elements). For example,
208+
a line: ``"BYTES uint64 e0id1"``:
209209

210-
- First column specifies an UniRec name. This name is used in a plugin configuration in
210+
- First parameter specifies an UniRec name. This name is used in a plugin configuration in
211211
the ``<uniRecFormat>`` element.
212-
- Second column specifies a data type of the UniRec field. List of all supported types is available
212+
- Second parameter specifies a data type of the UniRec field. List of all supported types is available
213213
in `UniRec documentation <https://github.com/CESNET/Nemea-Framework/tree/master/unirec>`_.
214-
- The third column is identification of corresponding IPFIX Information Elements (IE). In this case,
215-
"e0id1" means IPFIX IE with Enterprise ID 0 and ID 1 (which is "octetDeltaCount").
216-
- The last column is a user description.
214+
- The third parameter is comma separated list of corresponding IPFIX Information Elements (IEs). In
215+
this case, "e0id1" means IPFIX IE with Private Enterprise ID 0 and IE ID 1 (which is
216+
"octetDeltaCount"). Instead of numeric identification an IE name in "<scope>:<name>" format
217+
can be also used, for example, ``"BYTES uint64 iana:octetDeltaCount"``.
217218

218-
To map more than one IPFIX IE to one UniRec element, IPFIX IEs may be written as a comma
219-
separated list of individual IEs (no space before and after comma). For example,
220-
``"SRC_IP ipaddr e0id8,e0id27 IPv4 or IPv6 source address"``.
219+
How to add a new conversion record
220+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
221221

222+
First of all, make sure that definitions of IPFIX Information Elements to convert are known to
223+
the IPFIXcol. The plugin needs to know the definitions to find appropriate conversion functions
224+
from IPFIX to UniRec data types. All definitions of IEs are provided
225+
by `libfds <https://github.com/CESNET/libfds/>`_ library and if any definition is missing, it is
226+
possible to add it manually to configuration. See the project website for help.
222227

228+
Now you can create a new entry in the configuration file. All three parameters, i.e. UniRec field
229+
name, UniRec type and list of IPFIX IEs, must be defined. If the mapping is configured correctly
230+
the new UniRec field can be used in the template specification i.e. ``<uniRecFormat>``.
223231

224-
TODO: how to add new element!! lnf + unirec
232+
Be aware that data types of IPFIX IEs and corresponding UniRec fields could be slightly different.
233+
When a value of an IPFIX field cannot fit into a UniRec field (e.g. conversion from 64b
234+
to 32b unsigned integer), the converted value is saturated (the maximum/minimum possible
235+
value is used) or extra bits are discarded. To distinguish these situation, the data semantic
236+
of used IPFIX IE is used. If its semantic is ``flags`` or ``identifier``, extra bits are
237+
discarded. Otherwise, the value is saturated.
225238

239+
Note: If saturation is applied and a negative integer is converted from signed to unsigned
240+
integer type, the result value is zero.
241+
242+
To see conversion warnings, add the UniRec field to ``<uniRecFormat>`` and run the collector
243+
with increased verbosity level i.e. ``ipfixcol2 -v``.
226244

227245
Note
228246
----
229247

230-
TODO: bidirectional flows are automatically split into two unidirectional flows
231-
TODO: if multiple IPFIX elements are mapped to the same UniRec field and the result is .....
248+
Bidirectional flows are now currently supported by UniRec, therefore, biflow records are
249+
automatically split into two unidirectional flow records during conversion.
232250

251+
When multiple IPFIX Information Elements are mapped to the same UniRec field and those IPFIX fields
252+
are present in an IPFIX record, the last field occurrence (in the appropriate IPFIX Template)
253+
is converted to the UniRec field.

0 commit comments

Comments
 (0)