# Export and Archive ClickHouse Flows in ntopng for Regulatory Compliance | ntop

> Most ntopng users make extensive use of ClickHouse support for storing historical flow data and running analysis on it. ClickHouse is highly optimized and off

[Blog](https://www.ntop.org/blog/)[Data Privacy](https://www.ntop.org/category/data-privacy/)[Features](https://www.ntop.org/category/features/)

# Export and Archive ClickHouse Flows in ntopng for Regulatory Compliance

July 31, 20252 min read

Most ntopng users make extensive use of **ClickHouse support for storing historical flow** data and running analysis on it. ClickHouse is highly optimized and offers a high compression rate (estimated at an average of 60 bytes per flow), allowing for long data retention even with limited storage.

However, to comply with regulations such as GDPR, SOX, HIPAA, and PCI DSS, it is often necessary to retain data for extended periods. This is manageable when flow rates are low to moderate, but can require significant disk space when flow rates are high.

To support long-term data retention on limited storage, we have introduced the ability to **export flow data** from the database. This feature allows administrators to back up data **to external long-term storage** systems before it is deleted due to TTL (time to live), **ensuring regulatory compliance** while freeing up local disk space.

## **Key Benefits**

-   **Regulatory Compliance**: Meet data retention requirements for GDPR, SOX, HIPAA, PCI DSS, and other regulations.
-   **Storage Optimization**: Export data before TTL deletion to free up space.
-   **Audit Trail**: Maintain historical network flow records for forensic analysis.
-   **Data Recovery**: Re-import archived flows for compliance investigations.

### **Configuration**

Enabling this feature is as simple as enabling the preference from the UI. From the Left navbar in ntopng: Settings **→** Preferences (Expert View) **→** Clickhouse, and toggle the option as shown in the picture below. With this configured, at each midnight ntopng will export flow records deleted due to TTL.

By default, flows are exported to /var/lib/ntopng, one file per each day is created before deleting data from the clickhouse database due to TTL. It is possible to configure a custom export path from the configuration file or from command line by setting the **–db-archive-dir <path>** parameter.

![Export and Archive ClickHouse Flows in ntopng for Regulatory Compliance, figure 1](/images/2025/07/Screenshot-2025-07-30-at-08.31.12.webp)

#### **Import Archived Data**

To restore exported flows for analysis, on a machine with clickhouse-client installed, run:

**clickhouse-client –query=”INSERT INTO ntopng.flows FORMAT Native” < FILE\_PATH**

After importing the archived flows using the command above, it is possible to inspect them from the UI:

1.  Navigate to **Flows** **→** **Historical** in the ntopng web interface
2.  Select the time range of your imported data

Alternatively then can be imported in any ClickHouse database and inspect them manually with clickhouse-client.

##### **Important Notes**

-   Imported data contains 1 day of data with UTC timestamp begin and end, so flows for date X 00:00:00 UTC +24h are stored in a single file.
-   Retention rules will delete imported data at midnight if outside the TTL window.
-   Plan imports accordingly for compliance analysis.

##### **Related Documentation**

-   How to start ntopng from command line or config file [ntopng Startup Configuration](https://www.ntop.org/guides/ntopng/how_to_start/index.html)
-   [ClickHouse Integration Guide](https://www.ntop.org/guides/ntopng/flow_dump/clickhouse/clickhouse.html)
-   [ClickHouse Cloud Setup](https://www.ntop.org/using-clickhouse-cloud-with-ntopng/)
-   Storage optimization for clickhouse and ntopng [ClickHouse Storage Optimization](https://github.com/ntop/ntopng/blob/dev/doc/README.clickhouse.md#clickhouse-is-eating-all-my-diskmemory)

##### **Conclusion**

The new ClickHouse flow export feature enhances ntopng’s Enterprise capabilities by providing automated compliance archival and storage management. Network administrators can now maintain regulatory compliance while optimizing storage resources through efficient data lifecycle management.  
  
Enjoy!

## 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

Technologies and TrendsOct 8, 2026

### [How we Redesigned Search in ntopng](https://www.ntop.org/how-we-redesigned-search-in-ntopng/)

ntopng has had a search box for a while, but it we made it better to allow search for menu entries too! This to speed up and improve the user experience and…

[![](/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…

## 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/export-and-archive-clickhouse-flows-in-ntopng-for-regulatory-compliance/