Skip to main content
mbenvenuti
Staff
Staff
October 16, 2024

Technical Tip: How to recover ignored events from ClickHouse

  • October 16, 2024
  • 0 replies
  • 314 views
Description This article describes how to recover ignored events from Clickhouse.
Scope FortiSIEM.
Solution

When FortiSIEM is configured with ClickHouse storage, it happens that some data is ignored in its cluster management because it cannot insert it in the local replication. As a result, some expected events might be missing from the result queries.

Here are the steps to follow to recover ignored data:

 

  1. Identify the ClickHouse data nodes.

From the GUI at Admin -> Settings -> ClickHouse Config, identify all the data nodes:

data_nodes.png

 

  1. Check for any ignored data.

Connect on each data node from CLI as root and run:

 

du -h --max-depth=1 /data-clickhouse-*/clickhouse/data/fsiem/events_replicated/detached/ | sort -hr
2.5M /data-clickhouse-hot-1/clickhouse/data/fsiem/events_replicated/detached/
1.6M /data-clickhouse-hot-1/clickhouse/data/fsiem/events_replicated/detached/ignored_18250-20240621_0_6968_2577
184K /data-clickhouse-hot-1/clickhouse/data/fsiem/events_replicated/detached/ignored_18250-20240621_6968_6968_0
180K /data-clickhouse-hot-1/clickhouse/data/fsiem/events_replicated/detached/ignored_18250-20240620_8013_8015_1
176K /data-clickhouse-hot-1/clickhouse/data/fsiem/events_replicated/detached/ignored_18250-20240621_6971_6971_0
176K /data-clickhouse-hot-1/clickhouse/data/fsiem/events_replicated/detached/ignored_18250-20240621_6970_6970_0
176K /data-clickhouse-hot-1/clickhouse/data/fsiem/events_replicated/detached/ignored_18250-20240621_6969_6969_0

 

Check and identify the part to recover along the size and the date(20240621) of data treated.

 

  1. Check data before recovery.

In the GUI from the Analytics tab, run a query for the chosen date (example 20240621)  starting from 00:00:00 till 23:59:59 and count the number of events :

 

analytics_before.png

 

  1. Recover the data.

For example, file ignored_18250-20240621_0_6968_2577 is chosen to be recovered for the next steps.

From data node CLI as root:

 

cd /data-clickhouse-hot-1/clickhouse/data/fsiem/events_replicated/detached/

mv ignored_18250-20240621_0_6968_2577 18250-20240621_0_6968_2577

clickhouse-client -q "alter table fsiem.events_replicated attach part '18250-20240621_0_6968_2577'"

 

Renew those operations on all the ignored parts and data nodes required.

 

  1. Check the data after the recovery.

In GUI from the Analytics tab, run the same query as before and compare:

 

analytics_after.png

Thought Leadership Security Summit. Outpace New Threats with AI - enhanced defense. Tuesday, Septmeber 15, 8:30 AM - 2:30 PM PT. The Golf Club at Newcastle, WA.
Virtual event | September 2026. SASE summit. The age of autonomous trust. Register here!