Troubleshooting Tip: Check per-table and per-device disk usage in ClickHouse for FortiSIEM
| Description | This article describes per-device disk usage in ClickHouse. While ClickHouse does not track disk usage per device natively, administrators can use clickhouse queries to get these type of details. |
| Scope | FortiSIEM. |
| Solution | This can achieve this by running below command on Supervisor cli :
This query lists the on-disk size of all active tables:
clickhouse-client --query="SELECT table, formatReadableSize(sum(bytes)) AS size FROM system.parts WHERE active GROUP BY table ORDER BY sum(bytes) DESC;" Example Output:
trace_log 1022.36 MiB
The following query calculates the total uncompressed raw event size for each device (reptDevIpAddr):
::ffff:10.5.146.54 2311644121
(Note: These are uncompressed values and do not represent exact on-disk usage.)
To get a more readable and closer approximation using the materialized _raw_event_size column:
clickhouse-client --query=" SELECT device, c, avg_raw_bytes, formatReadableSize(toUInt64(c * avg_raw_bytes)) AS approx_by_rawsize FROM ( SELECT toString(reptDevIpAddr) AS device, count() AS c, avg(_raw_event_size) AS avg_raw_bytes FROM fsiem.events_all WHERE reptDevIpAddr IS NOT NULL AND toString(reptDevIpAddr) != '::' GROUP BY device ORDER BY c DESC LIMIT 50 ); "
Example Output:
::ffff:10.5.146.54 12,827,883 180.28 2.15 GiB
clickhouse-client --query="SELECT disk_name, partition, extract(partition, '\(\d+,(\d+)\)') as date, formatReadableSize(sum(bytes_on_disk)), formatReadableSize(sum(data_uncompressed_bytes)) FROM system.parts WHERE (table = 'events_replicated') AND path LIKE '%hot-1%' AND active GROUP BY disk_name, partition ORDER BY disk_name ASC, date ASC;" Example Output: default (18250,20250619) 20250619 375.95 KiB 18.90 MiB This provides an estimated per-device data size based on the actual event payload length. |
