vflow
vflow copied to clipboard
Error while decoding json invalid character \x00
In IPFIX and Netflow, additionnal kind of records named "options" exists, such as interface table, vrf table or sampler options. They are additionnal mapping (eg. vrf_index => vrf_name) that are usefull when storing flows.
The templates for those usually advertise (tested on Cisco ASR) large size for the fields (such as 64 for vrf name). But the actual value is of variable length.
This leads to errors when decoding the json on the consumer (at least in golang), because the vflow producer uses string(*byteValue), which contains null bytes, to encode the data in json, and the golang stdlib for decoding json does not allow null byte in string litterals.
We could use the golang bytes.Trim
function to remove the null bytes before encoding to string to avoid this problem (although I don't know about the performance impact of this).