# Using ntopng as Generic Flow Collector (log files, firewall events, MQTT…) | ntop

[Blog](https://www.ntop.org/blog/)[ntopng](https://www.ntop.org/category/ntopng/)

# Using ntopng as Generic Flow Collector (log files, firewall events, MQTT…)

February 6, 20252 min read

Most users of our community use ntopng as flow (sFlow/NetFlow/IPFIX) collector with ntop tools such as nProbe or nProbe Cento. From time to time we receive inquiries about using it as generic flow collector for instance reading connection information from the firewall, log files/syslog, MQTT, or cloud formats. This blog post shows you howto do that,

![Python ntopng](/images/2025/02/Python_ntopng.webp)

ntopng can collect information via ZMQ, so the simplest mechanism is to export data on top of this protocol. ntopng accepts two formats implemented by the [nDPI serialization library](https://github.com/ntop/nDPI/blob/dev/src/include/ndpi_api.h#L1220):

-   binary TLV (all versions)
-   JSON (not supported on the community edition).

Serialized data can be sent uncompressed or [zlib](https://zlib.net/)\-compressed. The data format has to be <ID> <VALUE> where the <ID> is a number that specifies an information element part of [RFC 3954](https://datatracker.ietf.org/doc/html/rfc3954). Example L4\_SRC\_PORT is identified by ID 7, and IPV6\_SRC\_ADDR as 27. Please note that it is mandator to specify IP/port src/dst, protocol, bytes/packets in/out.

For instance in Python you have to write something like:

ntop\_flow = {
        "1":  int(connection\["bytes\_sent"\]),
        "2":  int(connection\["packets\_sent"\]),
        "22": rfc3339\_to\_unix\_epoch(connection\["start\_time"\]),
        "21": rfc3339\_to\_unix\_epoch(connection\["end\_time"\]),
        "8":  connection\["src\_ip"\],
        "7":  int(connection\["src\_port"\]),
        "12": connection\["dest\_ip"\],
        "11": int(connection\["dest\_port"\]),
        "4":  int(connection\["protocol"\])   
    }

    ntop\_flow\_compressed = zlib.compress(str.encode(json.dumps(ntop\_flow))
    header = build\_zmq\_msg\_hdr("flow", sys.getsizeof(ntop\_flow\_compressed), msg\_id, source\_id)
    flags = 0
    time.sleep(0.01)
    socket.send(header, flags | zmq.SNDMORE)
    rc = socket.send(ntop\_flow\_compressed, flags)

that sends the flow on the topic “flow” on which ntopng is listening.

Enjoy !

**Related:**[NetFlow, sFlow and IPFIX collector guide](https://www.ntop.org/netflow-sflow-ipfix-collector-analyzer/), [nProbe](https://www.ntop.org/products/netflow-probes/nprobe/)

## Keep reading

nDPINov 7, 2026

### [Detecting CVE-2026-98432 using nDPI/ntopng](https://www.ntop.org/detecting-cve-2026-98432-using-ndpi-ntopng/)

CVE-2026-98432 is a critical, 9.8-severity use-after-free (UAF) vulnerability in the Linux kernel’s IPv4 TCP networking stack. It allows an unauthenticated remote attacker to potentially cause system crashes, memory corruption, or execute arbitrary commands with root privileges. From a network stand

[![](/images/2026/09/Screenshot-2026-09-09-151028-1.webp)](https://www.ntop.org/october-20th-join-us-for-the-ntopng-7-0-webinar/)

AnnounceOct 5, 2026

### [October 20th: Join us for the ntopng 7.0 Webinar](https://www.ntop.org/october-20th-join-us-for-the-ntopng-7-0-webinar/)

Is your network monitoring keeping pace with AI, larger infrastructures, and the growing need for real observability? We’re excited to introduce ntopng 7.0, alongside new releases of the rest of the ntop…

[![](/images/2026/09/Screenshot-2026-09-09-163410-1.webp)](https://www.ntop.org/ntopng-user-interface-introducing-the-new-navigation-bar/)

ntopngSep 21, 2026

### [ntopng User Interface: Introducing the New Navigation Bar](https://www.ntop.org/ntopng-user-interface-introducing-the-new-navigation-bar/)

In our continuous effort to improve user experience and make network monitoring more intuitive, we have completely redesigned the ntopng Navigation Bar. As our feature set expands—with crucial additions like the nAnalyst…

## Try it on your own network

Download the free Community edition and see your first flows in five minutes.

[Download ntopng free](https://www.ntop.org/support/documentation/software-installation/)[Talk to an engineer](https://www.ntop.org/support/need-help/contacts/)
Source: https://www.ntop.org/using-ntopng-as-generic-flow-collector/