Skip to main content

Retention

After scraping we can choose to retain results on the basis of name, age, count and more.

The retention rules are applied for each unique catalog item. If changes is specified with type X and count 20, last 20 changes of X type would be kept for each catalog item

FieldDescriptionScheme
typesSpecify retention rules for config items[]ConfigItem
changesSpecify retention rules for changes[]Change
staleItemAgeConfig items that were last scraped after this age will be deletedDuration

Config Items

FieldDescriptionScheme
nameSpecify retention rules for changesstring
createdAgeAge after a config item is created it will be deletedDuration
updatedAgeAge after a config item last updated, that it will be deletedDuration
deletedAgeAge after a config item is soft deleted, will it be hard deleted.Duration
kubernetes-scraper.yaml
apiVersion: configs.flanksource.com/v1
kind: ScrapeConfig
metadata:
name: kubernetes-scraper
spec:
retention:
types:
- name: Kubernetes::Pod
deletedAge: 7d # keep deleted pods around for 7 days
- name: Kubernetes::Replicaset
deletedAge: 60m # we don't care about replicasets remove then quickly
kubernetes:
clusterName: local

Stale Config Items

With some scrapers (particularly custom scrapers), there is no defined event or field update to mark an item as deleted, in these cases stateItemAge will cleanup items that have not been scraped for specified period

kubernetes-scraper.yaml
apiVersion: configs.flanksource.com/v1
kind: ScrapeConfig
metadata:
name: kubernetes-scraper
spec:
retention:
staleItemAge: 30m
kubernetes:
clusterName: local

Changes

Changes can quickly accumulate and grow large over time. While it's important to retain some changes, others can be discarded after a period.

FieldDescriptionSchemeRequired
nameName of the change typestringtrue
ageMaximum age of the change type to retain (12h, 30d)Duration
countMaximum count to retain the change typeint
kubernetes-scraper.yaml
apiVersion: configs.flanksource.com/v1
kind: ScrapeConfig
metadata:
name: kubernetes-scraper
spec:
retention:
changes:
- name: PullSucceeded
age: 7d # Only keep one week of PullSucceeded changes
kubernetes:
clusterName: local