ipfixcol2-json-output(7)
hey bestie π welcome to the manual page for ipfixcol2-json-output(7) from the IPFIXcol collector. Itβs the JSON output plugin, and sheβs about to make your flow records cute and readable. β¨
πΈ NAME πΈ
ipfixcol2-json-output - JSON (output plugin) π
π¦ DESCRIPTION π¦
So basically, this plugin takes IPFIX flow records, converts them into JSON format, and sends them to remote destinations over the network, stores them into files, or prints them on standard output. Some elements (timestamps, IP/MAC addresses, TCP flags, etc.) can be converted into human readable format. Others are represented as plain numbers.
Each flow record is converted individually and sent to outputs, and hereβs the rule: at least one output method must be configured. No outputs, no vibes. π
β οΈ bestie, you need at least one output method configured. Thatβs not optional.
All fields in an IPFIX record are formatted as <field name>:<value>, where the field name represents a name of a corresponding Information Element as "<Enterprise Name>:<Information Element Name>" and value is a number, string, boolean or null (if conversion from IPFIX to JSON fails or it is a zero-length field). The Enterprise Name is a name of an organization that manages the field, such as IANA, CISCO, etc.
If the field name and type is unknown and ignoreUnknown option is disabled, the field name use format enXX:idYY where XX is an Enterprise Number and YY is an Information Element ID. See notes for instructions on how to add missing definitions of Information Elements.
Flow records with structured data types (basicList, subTemplateList and subTemplateMultiList) are supported. See the particular section below for information about the formatting of these types.
π¦ EXAMPLE OUTPUT π¦
The following output is for illustration purpose only. Available IPFIX fields depend on a structure of records that your exporter sends. See documentation of the exporter, if you want to change available IPFIX fields.
{
"@type": "ipfix.entry",
"iana:octetDeltaCount": 3568720,
"iana:packetDeltaCount": 2383,
"iana:flowStartMilliseconds": "2018-05-11T19:44:29.006Z",
"iana:flowEndMilliseconds": "2018-05-11T19:44:30.364Z",
"iana:ingressInterface": 1,
"iana:ipVersion": 4,
"iana:sourceIPv4Address": "192.168.0.100",
"iana:destinationIPv4Address": "192.168.0.101",
"iana:ipClassOfService": 0,
"iana:ipTTL": 62,
"iana:protocolIdentifier": "TCP",
"iana:tcpControlBits": ".AP.S.",
"iana:sourceTransportPort": 47200,
"iana:destinationTransportPort": 20810,
"iana:egressInterface": 0,
"iana:samplingInterval": 0,
"iana:samplingAlgorithm": 0
}
The plugin can produce multiple record types, which are always distinguished by "@type" key:
ipfix.entryβ Flow record captured by the exporter as shown in the example above. This record is always converted and it is the most common type.ipfix.optionsEntryβ Record containing additional information provided by the exporter to the collector. Usually it is used for information about the exporter configuration (such as packet sampling) and flow export statistics. Periodicity and content of the record always depends on the particular exporter. By default, record conversion is disabled, seeignoreOptionsparameter in the configuration section.ipfix.templateandipfix.optionsTemplateβ Records describing structure of flow records (i.e.ipfix.entry) and options records (i.e.ipfix.optionsEntry), respectively. These types are usually useful only for exporter analytics. Periodicity of these records usually depends on the exporter and used transport protocol. For example, for connection over UDP it corresponds to"template refresh interval"configured on the exporter. However, for TCP and SCTP sessions, the template records are usually sent only once immediately after session start. By default, template record conversion is disabled, seetemplateInfoparameter in the configuration section.
π EXAMPLE CONFIGURATION π
Below you see a complex configuration with all available output options enabled. Donβt forget to remove (or comment) outputs that you donβt want to use!
<output>
<name>JSON output</name>
<plugin>json</plugin>
<params>
<tcpFlags>formatted</tcpFlags>
<timestamp>formatted</timestamp>
<protocol>formatted</protocol>
<ignoreUnknown>true</ignoreUnknown>
<ignoreOptions>true</ignoreOptions>
<nonPrintableChar>true</nonPrintableChar>
<octetArrayAsUint>true</octetArrayAsUint>
<numericNames>false</numericNames>
<splitBiflow>false</splitBiflow>
<detailedInfo>false</detailedInfo>
<templateInfo>false</templateInfo>
<outputs>
<!-- Choose one or more of the following outputs -->
<server>
<name>Local server</name>
<port>8000</port>
<blocking>no</blocking>
</server>
<send>
<name>Send to my server</name>
<ip>127.0.0.1</ip>
<port>8000</port>
<protocol>tcp</protocol>
<blocking>no</blocking>
</send>
<print>
<name>Printer to standard output</name>
</print>
<file>
<name>Store to files</name>
<path>/tmp/ipfixcol/flow/%Y/%m/%d/</path>
<prefix>json.</prefix>
<timeWindow>300</timeWindow>
<timeAlignment>yes</timeAlignment>
<compression>none</compression>
</file>
<kafka>
<name>Send to Kafka</name>
<brokers>127.0.0.1</brokers>
<topic>ipfix</topic>
<blocking>false</blocking>
<partition>unassigned</partition>
<!-- Zero or more additional properties -->
<property>
<key>compression.codec</key>
<value>lz4</value>
</property>
</kafka>
</outputs>
</params>
</output>
okay bestie, buckle up β this is the part where we get into the knobs and dials π every single one of them, no skipping, we don't do that here.
β¨ PARAMETERS β¨
π Formatting parameters π
these control how your stuff gets cooked. pick your vibe, but pick wisely, iykyk:
tcpFlagsβ turns TCP flags into the cute human-readable format (something like.A..S.π) or just spits out a plain number (raw). [values: formatted/raw, default: formatted]timestampβ converts timestamps into ISO 8601 text (everything in UTC and milliseconds, like"2018-01-22T09:29:57.828Z"β¨) OR into a unix timestamp (and yes, all timestamps in milliseconds). [values: formatted/unix, default: formatted]protocolβ turns the protocol identification into the formatted style (like bestie, instead of6it literally writes"TCP") or into a plain number. [values: formatted/raw, default: formatted]ignoreUnknownβ skip those unknown Information Elements (aka record fields where the name and data type are a mystery π). If you turn this OFF, the data of unknown elements get formatted as unsigned integer or hexadecimal values. wanna know more? go peek at theoctetArrayAsUintoption. [values: true/false, default: true]ignoreOptionsβ skip the non-flow records that report metadata about IPFIX Exporting and Metering Processes (basically records described by Options Templates). [values: true/false, default: true]nonPrintableCharβ ignore non-printable characters (newline, tab, control characters, etc.) living inside IPFIX strings. If you disable this, those characters get escaped on output instead. [values: true/false, default: true]octetArrayAsUintβ converts each IPFIX field with octetArray type (including IPFIX fields with unknown definitions) as an unsigned integer, but only if the field size is less than or equal to 8 bytes. Fields bigger than that limit are always converted as a string showing the hexadecimal value, which is typically in network byte order (e.g."0x71E1"). β οΈ keep in mind that octetArray fields with variable length might get interpreted differently depending on their size. If you disable it, octetArray fields are never interpreted as unsigned integers, periodt. [values: true/false, default: true]numericNamesβ use only the short identification of Information Elements (likeenXX:idYY). If enabled, the short version gets used even when the field's definition is actually known. this option is lowkey a lifesaver for making shorter JSON records with key identifiers that don't depend on the internal configuration π [values: true/false, default: false]splitBiflowβ when you've got Biflow records, split that record into two unidirectional flow records π¦. Non-biflow records are literally unaffected. [values: true/false, default: false]detailedInfoβ adds extra info about the IPFIX message (like export time, Observation Domain ID, IP address of the exporter, etc.) that each record belongs to. those extra fields start with theipfix:prefix. [values: true/false, default: false]templateInfoβ convert Template and Options Template records. for the deets on how these records get formatted, scroll down to the particular section below. [values: true/false, default: false]
π Output types π
At least one of the following output must be configured. Multiple server/send/file/kafka outputs can be used at the same time β only if the outputs are not in collision with each other, bestie.
π₯οΈ server
TCP (push) server gives you data on a local port. Converted records get automatically send to all clients connected to that port. wanna test the server? use, for example, the ncat(1) utility: ncat <server ip> <port> πΈ
nameβ Identification name of the output. Used only for readability.portβ Local port number of the server.blockingβ Enable blocking on TCP sockets (true/false). If blocking mode is disabled and a client can't retrieve records fast enough, some flow records may be dropped (only individual clients are affected, so like, not the whole party). On the other hand, if blocking mode is enabled, no records are dropped. However β if at least one client is slow, the plugin waits (i.e. blocks) until data are send. this can significantly slow down the whole collector AND other output plugins, because processing records is suspended. and in the worst-case scenario? if the client isn't responding at all, the whole collector is blocked! π Therefore, it's usually preferred (and much safer) to disable blocking.
π¨ send
Send records over the network to a client. If the destination isn't reachable or the client is disconnected, the plugin drops all records and tries to reconnect every 5 seconds. and just like with server, you can verify functionality using the ncat(1) utility: ncat -lk <local ip> <local port> β¨
nameβ Identification name of the output. Used only for readability.ipβ IP address or domain name of the clientportβ Remote port numberprotocolβ Transport protocol: TCP or UDP (this field is case insensitive, so don't stress the caps π«Ά)blockingβ Enable blocking on a socket (true/false). See the description of this property at theserveroutput.
π file
Store data to files.
nameβ Identification name of the output. Used only for readability.pathβ The path specifies storage directory for data collected by the plugin. Format specifiers for day, month, etc. are supported, so you can create a suitable directory hierarchy. Seestrftimefor conversion specification. (Note: UTC time π)prefixβ Specifies name prefix for output files.timeWindowβ Specifies the time interval in seconds to rotate files [minimum 60, default 300]timeAlignmentβ Align file rotation with next N minute interval (yes/no).compressionβ Data compression helps to significantly reduce size of output files. Following compression algorithms are available:noneβ Compression disabled [default]gzipβ GZIP compression
π kafka
Send data to Kafka i.e. Kafka producer.
β οΈ Warning: Librarylibrdkafka< 1.5.0 contains a bug which might prevent the plugin from starting. If so, usejson-kafkaoutput plugin which implements workaround for this issue. π
nameβ Identification name of the output. Used only for readability.brokersβ Initial list of brokers as a CSV list of brokerhostorhost:port.topicβ Kafka topic to produce to.partitionβ Partition number to produce to. If the value is"unassigned", then the default random distribution is used. [default:"unassigned"]brokerVersionβ Older broker versions (before0.10.0) provide no way for a client to query for supported protocol features, making it impossible for the client to know what features it may use. As a workaround, a user may set this property to the expected broker version and the client will automatically adjust its feature set. [default:<empty>]blockingβ Enable blocking on produce. If disabled and a cluster is down or not able to retrieve records fast enough, some flow records may be dropped. On the other hand, if enabled, no records are dropped. However β if the cluster is slow or not accessible at all, the plugin waits (i.e. blocks) until data are send. This can significantly slow down or block(!) the whole collector and other output plugins [true/false, default: false]performanceTuningβ By default, the connection provided bylibrdkafkais not optimized for the high throughput required for transport of JSON records. This option adds optional library parameters, which reduces messaging overhead and significantly improves throughput π₯. In particular, Kafka message capacity is increased and maximal buffering interval is prolonged. These options can be overwritten by user defined properties. [true/false, default: true]propertyβ Additional configuration properties of thelibrdkafkalibrary as key/value pairs. Multiple<property>parameters, which can improve performance, can be defined. See the project website for the full list of supported options. Keep on mind that some options might not be available in all versions of the library.
π¨οΈ print
Write data on standard output.
nameβ Identification name of the output. Used only for readability.
π NOTES π
If one or more Information Element definitions are missing, you can easily add them π«Ά. All definitions are provided by the libfds <https://github.com/CESNET/libfds/> library. See the project website for help.
If a flow record contains multiple occurrences of the same Information Element, their values are stored into a single name/value pair as a JSON array. Order of the values in the array corresponds to their order in the flow record. β¨
For higher performance, it is advisable to use non-formatted conversion of IPFIX data types. In that case, you should prefer, for example, timestamps as numbers over ISO 8601 strings, and numeric identifiers of fields as they are usually shorted. π
π Structured data types π
So here's the tea, bestie: flow records can get extended with structured data types (the ones described in RFC6313). Every one of these types gets formatted as a JSON object carrying a "@type" field, and that field is literally the thing that tells you which formatting you're looking at. Also β and the standard is very clear on this β the semantic of the list is included too. No gatekeeping here. π
Say hi to basicList π β when converted, it contains "fieldID" with the Information Element identifier of zero or more Information Element(s) that live inside the list. All the values get stored as a JSON array in the "data" field. Look at her:
{
"example:blField": {
"@type": "basicList",
"semantic": "anyOf",
"fieldID": "iana:octetDeltaCount",
"data": [23, 34, 23]
}
}
Next up, subTemplateList π¦ β the converted version contains only one extra "data" field, and that's an array of zero or more JSON objects. Since every nested JSON object is described by the same IPFIX Template, it's guaranteed that their structure is the same too. Iconic. And the "semantic" field tells you the relationship among those different JSON objects:
{
"example:stlField": {
"@type": "subTemplateList",
"semantic": "allOf",
"data": [
{"keyA.1": "value1", "keyA.2": "value2"},
{"keyB.1": "value1", "keyB.2": "value2"},
]
}
}
Now subTemplateMultiList β¨ β she's giving similar to the previous type, except the sub-records can go even more nested. The "data" field contains a JSON array with zero or more nested JSON arrays. Each one of those nested arrays contains zero or more JSON objects, and again it's guaranteed that JSON objects sitting in the same array have the same structure. The "semantic" field describes the top-level relationship among the nested arrays:
{
"example:stmlField": {
"@type": "subTemplateMultiList",
"semantic": "allOf",
"data" : [
[
{"keyA.1": "value1", "keyA.2": "value2"},
{"keyB.1": "value1", "keyB.2": "value2"},
],
[
{"idA.1": "something", "idB.1": 123}
]
]
}
}
β οΈ Keep in mind that all of these structures can be nested inside each other. Yes, really. Inception vibes. π
π Template and Options Template records π
These records get converted only if the <templateInfo> option is enabled. That's the whole vibe check, no exceptions.
A Template record describes the structure of flow records, and its "@type" is "ipfix.template". The converted Template record contains an "ipfix:templateId" field β which is unique to the Transport Session and Observation Domain β plus "ipfix:fields", an array of JSON objects specifying the fields of flow records:
{
"@type": "ipfix.template",
"ipfix:templateId": 49171,
"ipfix:fields": [
{
"ipfix:elementId": 16399,
"ipfix:enterpriseId": 6871,
"ipfix:fieldLength": 1
}, {
"ipfix:elementId": 184,
"ipfix:enterpriseId": 29305,
"ipfix:fieldLength": 4
}, {
...
}
]
}
An Options Template record describes the structure of additional information for the collector β think sampling configuration, export statistics, that kind of thing. That description gets converted to a record whose "@type" equals "ipfix.optionsEntry". The converted Options Template record is basically the previous type's twin, except it carries one extra "ipfix:scopeCount" field, which specifies the number of scope fields in the record. And hello, important detail: a scope count of N specifies that the first N field specifiers are scope fields. π«Ά
{
"@type": "ipfix.optionsTemplate",
"ipfix:templateId": 53252,
"ipfix:scopeCount": 1,
"ipfix:fields": [
{
"ipfix:elementId": 130,
"ipfix:enterpriseId": 0,
"ipfix:fieldLength": 4
}, {
"ipfix:elementId": 103,
"ipfix:enterpriseId": 6871,
"ipfix:fieldLength": 4
}, {
...
]
]
}
π Author π
- LukΓ‘Ε‘ HutΓ‘k (
lukas.hutak@cesnet.cz) - Petr Velan (
petr.velan@cesnet.cz)
β Copyright β
Copyright Β© 2019 CESNET, z.s.p.o.
That's the whole page, bestie, and honestly? She ate. π
This was version 2.1 from 2018-09-20, aka the ipfixcol2-json-output(7) era β periodt. Go forth and parse responsibly β¨π¦πΈ
π¦ where this page comes from
- ubuntu stonking: ipfixcol2 2.8.0+20260701-1 Β· BSD-3-Clause OR GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms