You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With Logging version 5.6 and higher, you can configure retention policies based on log streams. Rules for these may be set globally, pertenant, or both. If you configure both, tenant rules apply before global rules.
10
+
You can configure retention policies based on log streams. You can set retention rules globally, per-tenant, or both. If you configure both, tenant rules apply before global rules.
Although logging version 5.9 and higher supports schema v12, v13 is recommended.
16
+
* Although logging version 5.9 and later supports schema `v12`, schema `v13` is recommended for future compatibility.
17
+
18
+
* For cost-effective log pruning, configure retention policies directly on the object storage provider. Use the lifecycle management features of the storage provider to ensure automatic deletion of old logs. This also avoids extra processing from Loki and delete requests to S3.
19
+
+
20
+
If the object storage does not support lifecycle policies, you must configure LokiStack to enforce retention internally. The supported retention period is up to 30 days.
16
21
====
17
22
18
-
. To enable stream-based retention, create a `LokiStack` CR:
23
+
.Prerequisites
24
+
25
+
* You have administrator permissions.
26
+
* You have installed the {loki-op}.
27
+
* You have installed the {oc-first}.
28
+
29
+
.Procedure
30
+
31
+
. To enable stream-based retention, create a `LokiStack` CR and save it as a YAML file. In the following example, it is called `lokistack.yaml`.
<1> Sets retention policy for all log streams. *Note: This field does not impact the retention period for stored logs in object storage.*
55
-
<2> Retention is enabled in the cluster when this block is added to the CR.
56
-
<3> Contains the link:https://grafana.com/docs/loki/latest/logql/query_examples/#query-examples[LogQL query] used to define the log stream.spec:
57
-
limits:
58
-
59
-
.Example per-tenant stream-based retention for AWS
68
+
<1> Set the retention policy for all log streams. This policy does not impact the retention period for stored logs in object storage.
69
+
<2> Enable retention in the cluster by adding the `retention` block to the CR.
70
+
<3> Specify the link:https://grafana.com/docs/loki/latest/logql/query_examples/#query-examples[LogQL query] to match log streams to the retention rule.
<1> Sets retention policy by tenant. Valid tenant types are `application`, `audit`, and `infrastructure`.
100
-
<2> Contains the link:https://grafana.com/docs/loki/latest/logql/query_examples/#query-examples[LogQL query] used to define the log stream.
101
-
102
-
2 Apply the `LokiStack` CR:
113
+
<1> Set the retention policy per-tenant. Valid tenant types are `application`, `audit`, and `infrastructure`.
114
+
<2> Specify the link:https://grafana.com/docs/loki/latest/logql/query_examples/#query-examples[LogQL query] to match log streams to the retention rule.
0 commit comments