Skip to content

Commit ef6eeed

Browse files
committed
OBSDOCS-1857: Fix Loki retention module and remove duplicate
1 parent b5f1ebe commit ef6eeed

File tree

3 files changed

+32
-138
lines changed

3 files changed

+32
-138
lines changed

configuring/configuring-the-log-store.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ include::modules/loki-pod-placement.adoc[leveloffset=+2]
5858

5959
include::modules/logging-loki-reliability-hardening.adoc[leveloffset=+2]
6060

61-
include::modules/loki-retention.adoc[leveloffset=+2]
61+
include::modules/logging-loki-retention.adoc[leveloffset=+2]
6262

6363

6464
include::modules/loki-memberlist-ip.adoc[leveloffset=+2]

modules/logging-loki-retention.adoc

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,35 @@
11
// Module included in the following assemblies:
22
//
33
// * observability/logging/log_storage/cluster-logging-loki.adoc
4+
// * configuring/configuring-the-log-store.adoc
45

56
:_mod-docs-content-type: PROCEDURE
67
[id="logging-loki-retention_{context}"]
78
= Enabling stream-based retention with Loki
89

9-
With Logging version 5.6 and higher, you can configure retention policies based on log streams. Rules for these may be set globally, per tenant, or both. If you configure both, tenant rules apply before global rules.
10+
With Logging version 5.6 and higher, you can configure retention policies based on log streams. Rules for these might be set globally, per-tenant, or both. If you configure both, tenant rules apply before global rules.
1011

1112
include::snippets/logging-retention-period-snip.adoc[]
1213

1314
[NOTE]
1415
====
15-
Although logging version 5.9 and higher supports schema v12, v13 is recommended.
16+
* Although logging version 5.9 and higher supports schema v12, v13 is recommended.
17+
18+
* Stream-based retention does not manage the retention for stored logs. You can configure global retention periods for stored logs to a supported maximum of 30 days in your object storage.
1619
====
1720

21+
.Prerequisites
22+
23+
* You have administrator permissions.
24+
* You have installed the {loki-op}.
25+
* You have installed the {oc-first}.
26+
27+
.Procedure
28+
1829
. To enable stream-based retention, create a `LokiStack` CR:
1930
+
20-
.Example global stream-based retention for AWS
31+
--
32+
.Example global stream-based retention for s3
2133
[source,yaml]
2234
----
2335
apiVersion: loki.grafana.com/v1
@@ -27,13 +39,13 @@ metadata:
2739
namespace: openshift-logging
2840
spec:
2941
limits:
30-
global: <1>
31-
retention: <2>
42+
global: # <1>
43+
retention: # <2>
3244
days: 20
3345
streams:
3446
- days: 4
3547
priority: 1
36-
selector: '{kubernetes_namespace_name=~"test.+"}' <3>
48+
selector: '{kubernetes_namespace_name=~"test.+"}' # <3>
3749
- days: 1
3850
priority: 1
3951
selector: '{log_type="infrastructure"}'
@@ -43,20 +55,20 @@ spec:
4355
storage:
4456
schemas:
4557
- effectiveDate: "2020-10-11"
46-
version: v11
58+
version: v13
4759
secret:
4860
name: logging-loki-s3
49-
type: aws
61+
type: s3
5062
storageClassName: gp3-csi
5163
tenants:
5264
mode: openshift-logging
5365
----
54-
<1> Sets retention policy for all log streams. *Note: This field does not impact the retention period for stored logs in object storage.*
66+
<1> Sets retention policy for all log streams. This field does not impact the retention period for stored logs in object storage.
5567
<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+
<3> Contains the link:https://grafana.com/docs/loki/latest/logql/query_examples/#query-examples[LogQL query] used to define the log stream `spec.limits`.
69+
--
70+
+
71+
.Example per-tenant stream-based retention for s3
6072
[source,yaml]
6173
----
6274
apiVersion: loki.grafana.com/v1
@@ -69,13 +81,13 @@ spec:
6981
global:
7082
retention:
7183
days: 20
72-
tenants: <1>
84+
tenants: # <1>
7385
application:
7486
retention:
7587
days: 1
7688
streams:
7789
- days: 4
78-
selector: '{kubernetes_namespace_name=~"test.+"}' <2>
90+
selector: '{kubernetes_namespace_name=~"test.+"}' # <2>
7991
infrastructure:
8092
retention:
8193
days: 5
@@ -88,19 +100,19 @@ spec:
88100
storage:
89101
schemas:
90102
- effectiveDate: "2020-10-11"
91-
version: v11
103+
version: v13
92104
secret:
93105
name: logging-loki-s3
94-
type: aws
106+
type: s3
95107
storageClassName: gp3-csi
96108
tenants:
97109
mode: openshift-logging
98110
----
99111
<1> Sets retention policy by tenant. Valid tenant types are `application`, `audit`, and `infrastructure`.
100112
<2> Contains the link:https://grafana.com/docs/loki/latest/logql/query_examples/#query-examples[LogQL query] used to define the log stream.
101113

102-
2 Apply the `LokiStack` CR:
103-
114+
. Apply the `LokiStack` CR:
115+
+
104116
[source,terminal]
105117
----
106118
$ oc apply -f <filename>.yaml

modules/loki-retention.adoc

Lines changed: 0 additions & 118 deletions
This file was deleted.

0 commit comments

Comments
 (0)