Skip to content

Commit 7d15dbb

Browse files
committed
Unirec output plugin: updated README.rst
1 parent 6bb9cad commit 7d15dbb

File tree

1 file changed

+120
-19
lines changed

1 file changed

+120
-19
lines changed

extra_plugins/output/unirec/README.rst

Lines changed: 120 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,108 @@
11
UniRec (output plugin)
22
======================
33

4-
The plugin converts flow records into UniRec records and sends that via TRAP output interface.
4+
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
6+
consists of one or more UniRec fields.
57

8+
Each flow record is converted individually. For each IPFIX field the plugin tries to find mapping
9+
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
11+
choose to drop the whole record or fill undefined UniRec fields with default values.
12+
Converted records are sent over a unix socket/tcp/tcp-tls for further processing or stored as
13+
files.
14+
15+
An instance of the plugin can use only one TRAP output interface and one UniRec template at the
16+
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
18+
consists of common fields available in all flow records and another instance converts only
19+
flow records that consist of HTTP fields.
20+
21+
How to build
22+
------------
23+
24+
By default, the plugin is not distributed with the IPFIXcol itself due to extra dependencies.
25+
To build the plugin, IPFIXcol (and its header files) and the following dependencies must be
26+
installed on your system:
27+
28+
- `Nemea Framework <https://github.com/CESNET/Nemea-Framework/tree/master>`_
29+
(or `Nemea <https://github.com/CESNET/Nemea>`_ project)
30+
31+
Finally, compile and install the plugin:
32+
33+
.. code-block:: sh
34+
35+
$ mkdir build && cd build && cmake ..
36+
$ make
37+
# make install
638
739
Example configuration
840
---------------------
941

10-
Below you can see a configuration with....
42+
The following output instance configuration describes all supported types of TRAP output
43+
interfaces, however, only one can be used. Therefore, remove all interfaces in ``<trapIfcSpec>``
44+
except the one you would like to use.
45+
46+
.. code-block:: xml
47+
48+
<output>
49+
<name>UniRec plugin</name>
50+
<plugin>unirec</plugin>
51+
<params>
52+
<uniRecFormat>TIME_FIRST,TIME_LAST,SRC_IP,DST_IP,PROTOCOL,?SRC_PORT,?DST_PORT,?TCP_FLAGS,PACKETS,BYTES</uniRecFormat>
53+
<trapIfcCommon>
54+
<timeout>NO_WAIT</timeout>
55+
<buffer>true</buffer>
56+
<autoflush>500000</autoflush>
57+
</trapIfcCommon>
58+
59+
<trapIfcSpec>
60+
<!-- Only ONE of the following output interface! -->
61+
<tcp>
62+
<port>8000</port>
63+
<maxClients>64</maxClients>
64+
</tcp>
65+
<tcp-tls>
66+
<port>8000</port>
67+
<maxClients>64</maxClients>
68+
<keyFile>...</keyFile>
69+
<certFile>...</certFile>
70+
<caFile>...</caFile>
71+
</tcp-tls>
72+
<unix>
73+
<name>ipfixcol-output</name>
74+
<maxClients>64</maxClients>
75+
</unix>
76+
<file>
77+
<name>/tmp/nemea/trapdata</name>
78+
<mode>write</mode>
79+
</file>
80+
</trapIfcSpec>
81+
</params>
82+
</output>
1183
1284
Parameters
1385
----------
1486

1587
:``uniRecFormat``:
1688
Comma separated list of UniRec fields. All fields are mandatory be default, therefore, if
17-
a flow record to convert doesn't contain all mandatory fields, it will be dropped.
18-
UniRec fields that start with '?' are optional and they are filled with default values if
19-
not present in the record (e.g. TCP_FLAGS).
20-
For example, "DST_IP,SRC_IP,BYTES,DST_PORT,?TCP_FLAGS,SRC_PORT,PROTOCOL".
21-
List of all supported UniRec fields is defined in `unirec-element.txt <unirec-elements.txt>`_
22-
file.
89+
a flow record to convert doesn't contain all mandatory fields, it is dropped.
90+
However, UniRec fields that start with '?' are optional and if they are not present in the
91+
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.
93+
Example value: "DST_IP,SRC_IP,BYTES,DST_PORT,?TCP_FLAGS,SRC_PORT,PROTOCOL".
2394

2495
:``trapIfcCommon``:
2596
The following parameters can be used with any type of a TRAP interface. There are parameters
26-
of the interface that are normally let default. It is possible to override them by user. The
27-
available parameters are:
97+
of the interface that are normally let default. However, it is possible to override them
98+
by user:
2899

29100
:``timeout``:
30101
Time in microseconds that the output interface can block waiting for message to be send.
31102
There are also special values: "WAIT" (block indefinitely), "NO_WAIT" (don't block),
32-
"HALF_WAIT" (block only if some client is connected). [default: "HALF_WAIT"]
103+
"HALF_WAIT" (block only if some client is connected). Be very careful, inappropriate
104+
configuration can significantly slowdown the collector and lead to loss of data.
105+
[default: "HALF_WAIT"]
33106

34107
:``buffer``:
35108
Enable buffering of data and sending in larger bulks (increases throughput)
@@ -41,20 +114,22 @@ Parameters
41114
[default: 500000]
42115

43116
:``trapIfcSpec``:
44-
Specification of interface type and its parameters. Only one of the following output type can
45-
be used at the same time: unix, tcp, tcp-tls, file. For more details, see section
117+
Specification of interface type and its parameters. For more details, see section
46118
"Output interface types".
47119

48120
Output interface types
49121
----------------------
122+
Exactly one of the following output type must be defined in the instance configuration of this
123+
plugin.
50124

51125
:``unix``:
52126
Communicates through a UNIX socket. The output interface creates a socket and listens, input
53127
interface connects to it. There may be more than one input interfaces connected to the output
54128
interface, every input interface will get the same data. Parameters:
55129

56130
:``name``:
57-
Socket name. Any string usable as a file name.
131+
Socket name i.e. any string usable as a file name. The name MUST not include colon
132+
character.
58133

59134
:``maxClients``:
60135
Maximal number of connected clients (input interfaces). [default: 64]
@@ -72,10 +147,11 @@ Output interface types
72147

73148
:``tcp-tls``:
74149
Communicates through a TCP socket after establishing encrypted connection. You have to
75-
provide a certificate, a private key and a CA chain file with trusted CAs. Otherwise same
150+
provide a certificate, a private key and a CA chain file with trusted CAs. Otherwise, same
76151
as TCP: The output interface listens on a given port, input interface connects to it.
77152
There may be more than one input interfaces connected to the output interface,
78-
every input interface will get the same data. Parameters:
153+
every input interface will get the same data. Paths to files MUST not include colon character.
154+
Parameters:
79155

80156
:``port``:
81157
Local port number
@@ -93,14 +169,14 @@ Output interface types
93169
Path to a file of trusted CA certificates in PEM format.
94170

95171
:``file``:
96-
Store UniRec records into a file. The interface allows to split data into multiple files
172+
Stores UniRec records into a file. The interface allows to split data into multiple files
97173
after a specified time or a size of the file. If both options are enabled at the same time,
98174
the data are split primarily by time, and only if a file of one time interval exceeds
99-
the size limit, it is further splitted. The index of size-splitted file is appended after the
175+
the size limit, it is further split. The index of size-split file is appended after the
100176
time. Parameters:
101177

102178
:``name``:
103-
Name of the output file.
179+
Name of the output file. The name MUST not include colon character.
104180

105181
:``mode``:
106182
Output mode: ``write``/``append``. If the specified file exists, mode ``write`` overwrites
@@ -117,3 +193,28 @@ Output interface types
117193
files after a size of a current file (in MB) exceeds given threshold. Numeric suffix is
118194
added to the original file name for each file in ascending order starting with 0.
119195
[default: 0]
196+
197+
198+
UniRec configuration file
199+
-------------------------
200+
201+
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
203+
with the plugin and it is usually placed in the same directory as the default IPFIXcol startup
204+
configuration (see ``ipfixcol2 -h`` for help).
205+
206+
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"``:
209+
210+
- First column specifies an UniRec name. This name is used in a plugin configuration in
211+
the ``<uniRecFormat>`` element.
212+
- Second column specifies a data type of the UniRec field. List of all supported types is available
213+
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.
217+
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"``.

0 commit comments

Comments
 (0)