Skip to content

Commit 1def882

Browse files
committed
JSON output: fix template examples, add information about record types
1 parent 67d123f commit 1def882

File tree

1 file changed

+82
-47
lines changed

1 file changed

+82
-47
lines changed

src/plugins/output/json/README.rst

Lines changed: 82 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ Each flow record is converted individually and send to outputs where at least on
1010
method must be configured. All fields in an IPFIX record are formatted as: <field name>:<value>,
1111
where the *field name* represents a name of a corresponding Information Element as
1212
"<Enterprise Name>:<Information Element Name>" and *value* is a number, string,
13-
boolean or null (if conversion from IPFIX to JSON fails). The Enterprise Name is a name of an
14-
organization that manages the field, such as IANA, CISCO, etc.
13+
boolean or null (if conversion from IPFIX to JSON fails or it is a zero-length field). The
14+
Enterprise Name is a name of an organization that manages the field, such as IANA, CISCO, etc.
1515

1616
If the field name and type is unknown and "ignoreUnknown" option is disabled, the field name
1717
use format 'enXX:idYY' where XX is an Enterprise Number and YY is an Information Element ID.
1818
See notes for instructions on how to add missing definitions of Information Elements.
1919

20-
Structured data types (basicList, subTemplateList and subTemplateMultiList) are supported. See
21-
the particular section below for information about their formatting.
20+
Flow records with structured data types (basicList, subTemplateList and subTemplateMultiList) are
21+
supported. See the particular section below for information about the formatting of these types.
2222

2323
Example output
2424
--------------
@@ -50,6 +50,27 @@ if you want to change available IPFIX fields.
5050
"iana:samplingAlgorithm": 0
5151
}
5252
53+
The plugin can produce multiple record types, which are always distinguished by "@type" key:
54+
55+
:``ipfix.entry``:
56+
Flow record captured by the exporter as shown in the example above. This record is always
57+
converted and it is the most common type.
58+
:``ipfix.optionsEntry``:
59+
Record containing additional information provided by the exporter to the collector. Usually
60+
it is used for information about the exporter configuration (such as packet sampling)
61+
and flow export statistics. Periodicity and content of the record always depends on the
62+
particular exporter. By default, record conversion is disabled, see ``ignoreOptions`` parameter
63+
in the configuration section.
64+
:``ipfix.template`` and ``ipfix.optionsTemplate``:
65+
Records describing structure of flow records (i.e. ``ipfix.entry``) and options records
66+
(i.e. ``ipfix.optionsEntry``), respectively. These types are usually useful only for
67+
exporter analytics. Periodicity of these records usually depends on the exporter and used
68+
transport protocol. For example, for connection over UDP it corresponds to
69+
"template refresh interval" configured on the exporter. However, for TCP and SCTP sessions,
70+
the template records are usually sent only once immediately after session start.
71+
By default, template record conversion is disabled, see ``templateInfo`` parameter in the
72+
configuration section.
73+
5374
Example configuration
5475
---------------------
5576

@@ -70,8 +91,8 @@ Don't forget to remove (or comment) outputs that you don't want to use!
7091
<nonPrintableChar>true</nonPrintableChar>
7192
<numericNames>false</numericNames>
7293
<splitBiflow>false</splitBiflow>
73-
<detailedInfo>false</detailedInfo>
74-
<templateInfo>false</templateInfo>
94+
<detailedInfo>false</detailedInfo>
95+
<templateInfo>false</templateInfo>
7596
7697
<outputs>
7798
<server>
@@ -145,12 +166,13 @@ Formatting parameters:
145166
records are unaffected. [values: true/false, default: false]
146167

147168
:``detailedInfo``:
148-
Add detailed info about the IPFIX message (export time, sequence number, ...) to each record
149-
under "ipfix:" prefix. [values: true/false, default: false]
169+
Add additional information about the IPFIX message (such as export time, Observation Domain ID,
170+
IP address of the exporter, etc.) to which each record belongs. Additional fields starts
171+
with "ipfix:" prefix. [values: true/false, default: false]
150172

151173
:``templateInfo``:
152-
Add Template and Options Template records to the top of the exported JSON file with prefix
153-
"ipfix.template" and "ipfix.optionsTemplate". [values: true/false, default: false]
174+
Convert Template and Options Template records. See the particular section below for
175+
information about the formatting of these records. [values: true/false, default: false]
154176

155177
----
156178

@@ -290,44 +312,57 @@ Keep on mind that all structures can be nested in each other.
290312
Template and Options Template records
291313
-------------------------------------
292314

293-
Template and Options Template records are special records.
315+
These records are converted only if ``<templateInfo>`` option is enabled.
294316

295-
*Template record* describes structure of flow records, and its type is "ipfix.template".
296-
Converted *Template record* contains "ipfix:templateId" field, which is unique to the Transport Session
297-
and Observation Domain and "ipfix:fields" which is an array of JSON objects specifing fields of flow records.
317+
*Template record* describes structure of flow records, and its "@type" is "ipfix.template".
318+
Converted Template record contains "ipfix:templateId" field, which is unique to the Transport
319+
Session and Observation Domain, and "ipfix:fields", which is an array of JSON objects specifying
320+
fields of flow records.
298321

299322
.. code-block:: json
300-
{
301-
"@type": "ipfix.template",
302-
"ipfix:templateId": "49171",
303-
"ipfix:fields": [{
304-
"ipfix:elementId": "16399",
305-
"ipfix:enterpriseId": "6871",
306-
"ipfix:fieldLength": "1"
307-
}, {
308-
"ipfix:elementId": "184",
309-
"ipfix:enterpriseId": "29305",
310-
"ipfix:fieldLength": "4"
311-
}]
312-
}
313-
314-
*Options Template record* describes structure of additional information for the collector.
315-
These additional information are converted to record with type "ipfix.optionsEntry".
316-
Converted *Options Template record* is similar to previous type, however it contains also
317-
"ipfix:scopeCount" field, which specifies number of scope fields in the record.
318-
323+
324+
{
325+
"@type": "ipfix.template",
326+
"ipfix:templateId": 49171,
327+
"ipfix:fields": [
328+
{
329+
"ipfix:elementId": 16399,
330+
"ipfix:enterpriseId": 6871,
331+
"ipfix:fieldLength": 1
332+
}, {
333+
"ipfix:elementId": 184,
334+
"ipfix:enterpriseId": 29305,
335+
"ipfix:fieldLength": 4
336+
}, {
337+
...
338+
}
339+
]
340+
}
341+
342+
*Options Template record* describes structure of additional information for the collector, such as
343+
sampling configuration, export statistics, etc. The description is converted to a record with
344+
"@type" equal to "ipfix.optionsEntry". Converted Options Template record is similar
345+
to the previous type, however, it contains additional "ipfix:scopeCount" field, which specifies
346+
number of scope fields in the record. A scope count of N specifies that the first N field
347+
specifiers are scope fields.
348+
319349
.. code-block:: json
320-
{
321-
"@type": "ipfix.optionsTemplate",
322-
"ipfix:templateId": "53252",
323-
"ipfix:scopeCount": "3",
324-
"ipfix:fields": [{
325-
"ipfix:elementId": "322",
326-
"ipfix:enterpriseId": "0",
327-
"ipfix:fieldLength": "4"
328-
}, {
329-
"ipfix:elementId": "554",
330-
"ipfix:enterpriseId": "6871",
331-
"ipfix:fieldLength": "65535"
332-
}]
333-
}
350+
351+
{
352+
"@type": "ipfix.optionsTemplate",
353+
"ipfix:templateId": 53252,
354+
"ipfix:scopeCount": 1,
355+
"ipfix:fields": [
356+
{
357+
"ipfix:elementId": 130,
358+
"ipfix:enterpriseId": 0,
359+
"ipfix:fieldLength": 4
360+
}, {
361+
"ipfix:elementId": 103,
362+
"ipfix:enterpriseId": 6871,
363+
"ipfix:fieldLength": 4
364+
}, {
365+
...
366+
}
367+
]
368+
}

0 commit comments

Comments
 (0)