Retention for expired decisions, independent of alert retention

オープン
#4,703 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
52/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
go
領域
databases

調査の方向性

Start by reading the existing flush.max_age behavior and FlushOrphans, then review issue #4613 for measurements of the longestDecisionForScopeTypeValue query shape. The change should allow expired decisions to be retained independently of their parent alerts while preserving the configured window for reporting deletions to bouncers. Verify the new behavior and configuration with tests, including the stated trade-off for inspecting old alerts.

索引モデルが issue の本文から書いたものです。

説明

kind/enhancement needs/triage

/kind enhancement

What would you like to be added?

A retention setting for expired decisions that's independent of alert retention — something like db_config.flush.decisions_max_age. Expired decision rows would be deleted that long after they expire, separately from their parent alert, much as FlushOrphans already deletes ownerless expired decisions.

Why is this needed?

flush.max_age is currently doing three unrelated jobs:

  1. how long alerts stay queryable
  2. how much dead weight every stream query walks through
  3. how long an expired decision stays reportable to bouncers in the deleted array

There's no way to tune them separately, and 1 and 3 pull against each other.

On our LAPI (~1.2k bouncers, 60s poll) decisions sits at 612k rows with 301k already expired: a 6-hourly blocklist import with an 8h TTL against max_age: 26h leaves each batch dead in the table for 18h. Every startup=true resync walks all of it through the longestDecisionForScopeTypeValue anti-join — #4613 has measurements for that query shape.

Pushing the ban TTL past max_age fixes the bloat, since #4527 keeps an alert alive while its decisions are active. But then the alert is flushed within a minute of the last decision expiring and the cascade hard-deletes the rows, so a bouncer only learns about the unban if it polls inside that ~60s window. Roughly half the fleet misses it.

What I'd like to be able to configure: 7d of alert history, deletions reported for 12h, and not carrying 7d of expired decisions in every stream query.

The obvious cost is that cscli alerts inspect on an old alert would show fewer decisions than it does today. That seems like the right trade to me, but it's a behaviour change worth naming.

主要言語
Go
スター
15.1k
フォーク
726
平均マージ
1日 10時間
マージ済み PR(30日)
15

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

crowdsecurity/crowdsec のほかの issue

crowdsecurity/crowdsec の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。