Modify system configuration¶
Observability will persist the data of metrics, logs, and traces by default. Users can modify the system configuration according to This page.
How to modify the metric data retention period¶
Refer to the following steps to modify the metric data retention period.
-
run the following command:
-
In the Yaml file, the default value of
retentionPeriod
is14
, and the unit isday
. You can modify the parameters according to your needs.apiVersion: operator.victoriametrics.com/v1beta1 kind: VMCluster metadata: annotations: meta.helm.sh/release-name: insight meta.helm.sh/release-namespace: insight-system creationTimestamp: "2022-08-25T04:31:02Z" finalizers: - apps.victoriametrics.com/finalizer generation: 2 labels: app.kubernetes.io/instance: insight app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: victoria-metrics-k8s-stack app.kubernetes.io/version: 1.77.2 helm.sh/chart: victoria-metrics-k8s-stack-0.9.3 name: insight-victoria-metrics-k8s-stack namespace: insight-system resourceVersion: "123007381" uid: 55cee8d6-c651-404b-b2c9-50603b405b54 spec: replicationFactor: 1 retentionPeriod: "14" vminsert: extraArgs: maxLabelsPerTimeseries: "45" image: repository: docker.m.daocloud.io/victoriametrics/vminsert tag: v1.80.0-cluster replicaCount: 1
-
After saving the modification, the pod of the component responsible for storing the metrics will automatically restart, just wait for a while.
How to modify the log data storage duration¶
Refer to the following steps to modify the log data retention period:
Method 1: Modify the Json file¶
-
Modify the
max_age
parameter in therollover
field in the following files, and set the retention period. The default storage period is7d
. Changehttp://localhost:9200
to the address ofelastic
.curl -X PUT "http://localhost:9200/_ilm/policy/insight-es-k8s-logs-policy?pretty" -H 'Content-Type: application/json' -d' { "policy": { "phases": { "hot": { "min_age": "0ms", "actions": { "set_priority": { "priority": 100 }, "rollover": { "max_age": "7d", "max_size": "10gb" } } }, "warm": { "min_age": "10d", "actions": { "forcemerge": { "max_num_segments": 1 } } }, "delete": { "min_age": "30d", "actions": { "delete": {} } } } } }
-
After modification, run the above command. It will print out the content as shown below, then the modification is successful.
Method 2: Modify from the UI¶
-
Log in
kibana
, selectStack Management
in the left navigation bar. -
Select the left navigation
Index Lifecycle Polices
, and find the indexinsight-es-k8s-logs-policy
, click to enter the details. -
Expand the
Hot phase
configuration panel, modify theMaximum age
parameter, and set the retention period. The default storage period is7d
. -
After modification, click
Save policy
at the bottom of the page to complete the modification.
How to modify the trace data storage duration¶
Refer to the following steps to modify the trace data retention period:
Method 1: Modify the Json file¶
-
Modify the
max_age
parameter in therollover
field in the following files, and set the retention period. The default storage period is7d
. At the same time, modifyhttp://localhost:9200
to the access address ofelastic
.curl -X PUT "http://localhost:9200/_ilm/policy/jaeger-ilm-policy?pretty" -H 'Content-Type: application/json' -d' { "policy": { "phases": { "hot": { "min_age": "0ms", "actions": { "set_priority": { "priority": 100 }, "rollover": { "max_age": "7d", "max_size": "10gb" } } }, "warm": { "min_age": "10d", "actions": { "forcemerge": { "max_num_segments": 1 } } }, "delete": { "min_age": "30d", "actions": { "delete": {} } } } } }
-
After modification, run the above command on the console. It will print out the content as shown below, then the modification is successful.
Method 2: Modify from the UI¶
-
Log in
kibana
, selectStack Management
in the left navigation bar. -
Select the left navigation
Index Lifecycle Polices
, and find the indexjaeger-ilm-policy
, click to enter the details. -
Expand the
Hot phase
configuration panel, modify theMaximum age
parameter, and set the retention period. The default storage period is7d
. -
After modification, click
Save policy
at the bottom of the page to complete the modification.