Skip to content

Commit 8bc7358

Browse files
Cortex-DMSDonna-Marie Smith
andauthored
added steps for configuring Loki Retention Period (#247)
Co-authored-by: Donna-Marie Smith <donna.smith@wearecortex.com>
1 parent bc32d82 commit 8bc7358

File tree

13 files changed

+199
-5
lines changed

13 files changed

+199
-5
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: "4.1.0 to 4.2.0"
3+
linkTitle: "4.1.0 to 4.2.0"
4+
description: "Instructions to upgrade your observability platform for {{% ctx %}} from 4.1.0 to 4.2.0."
5+
weight: 970
6+
---
7+
8+
{{% alert title="Note" %}}
9+
There is no upgrade to 4.2.0 required for cloud-hosted observability platforms.
10+
{{% / alert %}}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: "On-Premise"
3+
linkTitle: "On-Premise"
4+
description: "Information about upgrading an on-premise observability platform for {{% ctx %}}."
5+
weight: 1
6+
---
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: "Grafana"
3+
linkTitle: "Grafana"
4+
description: "Information about upgrading an on-premise Grafana platform for {{% ctx %}}."
5+
weight: 1
6+
---
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: "Prerequisites"
3+
linkTitle: "Prerequisites"
4+
description: "The prerequisites required before performing the observability upgrade."
5+
weight: 1
6+
---
7+
8+
# {{% param title %}}
9+
10+
## Verify Upgrade Required
11+
12+
On the server that Grafana Loki is installed on:
13+
14+
1. Log in to the server.
15+
1. Open a File Explorer and navigate to the folder that Grafana Loki is running from, e.g. `C:\ProgramData\Cortex\Observability\Loki`.
16+
1. Open the `loki-local-config.yaml` configuration file in a text editor.
17+
1. Search the file for `compactor:`.
18+
1. If the search returns no results, proceed with the upgrade process, if results are returned then Observability has already been updated to 4.2.0 automatically as part of the [3.0.0 to 4.0.0][] upgrade and no further steps are required.
19+
20+
## Backup Old Files
21+
22+
1. On the server that Grafana Loki is installed on, create a folder called `Observability Backups` in a known location.
23+
1. Open File Explorer and navigate to the location that Grafana Loki is running from, e.g. `C:\ProgramData\Cortex\Observability\Loki\`.
24+
1. Copy the `loki-local-config.yaml` file and save it to the `Observability Backups` folder created at step 1.
25+
26+
## Next Steps?
27+
28+
1. [Upgrade Grafana Loki][]
29+
30+
[3.0.0 to 4.0.0]: {{< url path="Cortex.Guides.UpgradeGuides.UpgradeObservability.3.0.0to4.0.0.OnPremise.Grafana.MainDoc" >}}
31+
[Upgrade Grafana Loki]: {{< url path="Cortex.Guides.UpgradeGuides.UpgradeObservability.4.1.0to4.2.0.OnPremise.Grafana.UpgradeLoki" >}}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
title: "Try it out"
3+
linkTitle: "Try it out"
4+
description: "Information about trying out the observability platform after upgrade."
5+
weight: 5
6+
---
7+
8+
# {{% param title %}}
9+
10+
This guide describes how to verify that the upgrade has been successful. Please ensure that [Upgrade Grafana Loki][Upgrade Loki] has been completed before taking these steps.
11+
12+
## Confirm New Data is Processed
13+
14+
{{% alert title="Note" %}}
15+
This test uses the test flow published as part of testing the {{% ctx %}} installation. See {{< ahref path="Cortex.GettingStarted.OnPremise.InstallInnovationOnly.MultipleServerWithHA.TryItOutPublishedFlowNew" title="Testing HA installation" >}} or {{< ahref path="Cortex.GettingStarted.OnPremise.InstallInnovationOnly.SingleServerWithoutHA.TryItOutPublishedFlowNew" title="Testing non-HA installation" >}}. An alternative flow can be used that exists on the system and can be executed.
16+
{{% / alert %}}
17+
18+
1. Open an HTTP client, such as [Postman][]. Make a request with the following format:
19+
| Property | Value |
20+
|---------------|-------------------------------------------------------------------------------------|
21+
| Action | POST |
22+
| URL | For HA installation use: <br />`https://{FQDN of Load Balancer Server}/api/default/default/flows/{Flow Name}/executions?packageName={Package Name}`<br />e.g. `https://load-balancer.domain.com/api/default/default/flows/NewFlow/executions?packageName=NewPackage` <br /><br /> For non-HA installation use: <br />`https://{FQDN of server}:8722/api/default/default/flows/{Flow Name}/executions?packageName={Package Name}`<br />e.g. `https://server.domain.com:8722/api/default/default/flows/NewFlow/executions?packageName=NewPackage`|
23+
| Content Type | application/json |
24+
| Body | {} |
25+
| Authentication| Basic |
26+
| Username | The value used for `ApiGatewayBasicAuthUsername` when installing Application Services. See [HA Installation script configuration][] or [Non-HA Installation script configuration][] for the value specified.|
27+
| Password | The value used for `ApiGatewayBasicAuthPassword` when installing Application Services (Unencrypted). See [HA Installation script configuration][] or [Non-HA Installation script configuration][] for the value specified.|
28+
29+
{{% alert title="Note" %}} If you used self-signed certificates when installing the Application Servers you may need to disable SSL certificate validation in your HTTP client. {{% /alert %}}
30+
31+
1. Once the request has completed, in your web browser, navigate to and log in to your configured Grafana.
32+
1. Open the *Dashboards* page via the menu on the left sidebar.
33+
1. Click the folder name that the dashboards were imported to.
34+
1. Click the *Flow Execution Requests* dashboard to open it.
35+
1. The request made at step 1 should be visible on the dashboard.
36+
{{% alert title="Note" %}}
37+
If other requests have been made then there may be more than one request visible on the dashboard.
38+
{{% / alert %}}
39+
1. Open the *Dashboards* page via the menu on the left sidebar.
40+
1. Click the folder name that the dashboards were imported to.
41+
1. Click the *Platform Health* dashboard to open it.
42+
1. The request made at step 1 should be visible on the dashboard.
43+
{{% alert title="Note" %}}
44+
If other requests have been made then there may be more than one request visible on the dashboard.
45+
{{% / alert %}}
46+
47+
## Confirm Retention Period is being Applied
48+
49+
1. In a web browser, navigate to and log in to your configured Grafana.
50+
1. Open the *Flow Execution Requests* dashboard.
51+
1. Set the *Time Filter* to be a period greater than the retention period that has been set.
52+
1. Ensure that there is no data available for the time period that is greater than the retention period.
53+
54+
{{% alert title="Note" %}}
55+
Loki may take some time to remove logs older than the retention period, therefore, if there is still data available beyond the retention period, repeat the above steps at a later time.
56+
{{% / alert %}}
57+
58+
[HA Installation script configuration]: {{< url path="Cortex.GettingStarted.OnPremise.InstallInnovationOnly.MultipleServerWithHA.ConfigureInstallationScriptNew" >}}
59+
[Upgrade Loki]: {{< url path="Cortex.Guides.UpgradeGuides.UpgradeObservability.4.1.0to4.2.0.OnPremise.Grafana.UpgradeLoki" >}}
60+
[Non-HA Installation script configuration]: {{< url path="Cortex.GettingStarted.OnPremise.InstallInnovationOnly.SingleServerWithoutHA.ConfigureInstallationScriptNew" >}}
61+
[Postman]: {{< url path="Postman.Downloads.MainDoc" >}}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
title: "Upgrade Grafana Loki"
3+
linkTitle: "Upgrade Grafana Loki"
4+
description: "The steps to Upgrade Grafana Loki."
5+
weight: 4
6+
---
7+
8+
# {{% param title %}}
9+
10+
This guide describes how to upgrade Grafana Loki. Please ensure that the [Prerequisites][] have been completed before starting this upgrade.
11+
12+
## Perform Upgrade
13+
14+
On the server that Grafana Loki is installed on:
15+
16+
1. Log in to the server.
17+
1. Open a File Explorer and navigate to the folder that Grafana Loki is running from, e.g. `C:\ProgramData\Cortex\Observability\Loki`.
18+
1. Open the `loki-local-config.yaml` configuration file in a text editor.
19+
1. Copy the following code and paste it in to the `loki-local-config.yaml` file. It should be added immediately before the `schema_config:` section typically found on line 30.
20+
21+
``` text
22+
compactor:
23+
retention_enabled: true
24+
delete_request_store: filesystem
25+
working_directory: /data/retention
26+
27+
```
28+
29+
1. Copy the following code and paste it in to the `loki-local-config.yaml` file. It should be added to the end of the `limits_config:` section typically found on line 55 after the addition of the code in the previous step.
30+
31+
``` text
32+
retention_period: 8760h
33+
```
34+
35+
1. If a different retention period to the default of 12 months (8760 hours) is required, change the value ensuring that only the required retention is configured.
36+
1. Save the file.
37+
1. Restart the Grafana Loki Service:
38+
1. Open `services.msc`.
39+
1. Locate the `Loki` service.
40+
1. Right click on the service name and select `Restart`. If the service is not already running, select `Start`.
41+
42+
## Next Steps?
43+
44+
1. [Try it out][]
45+
46+
[backed up]: {{< url path="Cortex.Guides.UpgradeGuides.UpgradeObservability.4.1.0to4.2.0.OnPremise.Grafana.BackupOldFiles" >}}
47+
[Prerequisites]: {{< url path="Cortex.Guides.UpgradeGuides.UpgradeObservability.4.1.0to4.2.0.OnPremise.Grafana.Prerequisites" >}}
48+
[Try it out]: {{< url path="Cortex.Guides.UpgradeGuides.UpgradeObservability.4.1.0to4.2.0.OnPremise.Grafana.TryItOut" >}}

content/en/docs/2025.11/getting-started/cloud/add-observability-to-innovation/Grafana/import-dashboards.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,6 @@ To do this, follow these steps for all default {{% ctx %}} dashboards imported:
6666

6767
[configured Loki data source]: {{< url path="Cortex.GettingStarted.Cloud.AddObservabilityToInnovation.Grafana.SetupLoki.MainDoc" >}}
6868
[Grafana]: {{< url path="Cortex.GettingStarted.Cloud.AddObservabilityToInnovation.Grafana.SetupGrafana.MainDoc" >}}
69-
[Grafana.Dashboards.zip]: {{< url path="GitHub.Cortex.Observability.4.1.0.GrafanaDashboardsZip" >}}
69+
[Grafana.Dashboards.zip]: {{< url path="GitHub.Cortex.Observability.4.2.0.GrafanaDashboardsZip" >}}
7070
[Loki]: {{< url path="Cortex.GettingStarted.Cloud.AddObservabilityToInnovation.Grafana.SetupLoki.MainDoc" >}}
7171
[Try it Out]: {{< url path="Cortex.GettingStarted.Cloud.AddObservabilityToInnovation.Grafana.TryItOut.MainDoc" >}}

content/en/docs/2025.11/getting-started/cloud/add-observability-to-innovation/Grafana/install-alloy/install-alloy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ This archive contains the `config.alloy` configuration file and PowerShell scrip
2727

2828
[Configure Grafana Alloy]: {{< url path="Cortex.GettingStarted.Cloud.AddObservabilityToInnovation.Grafana.InstallAlloy.ConfigureAlloy.MainDoc" >}}
2929
[Grafana Alloy 1.10.2]: {{< url path="Grafana.Products.Loki.Alloy.1.10.2" >}}
30-
[Grafana Alloy.zip]: {{< url path="GitHub.Cortex.Observability.4.1.0.GrafanaAlloyInstallZip" >}}
30+
[Grafana Alloy.zip]: {{< url path="GitHub.Cortex.Observability.4.2.0.GrafanaAlloyInstallZip" >}}
3131
[Prerequisites]: {{< url path="Cortex.GettingStarted.OnPremise.AddObservabilityToInnovation.Grafana.Prerequisites" >}}

content/en/docs/2025.11/getting-started/on-premise/add-observability-to-innovation/Grafana/install-alloy/install-alloy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ This archive contains the `config.alloy` configuration file and PowerShell scrip
2727

2828
[Configure Grafana Alloy]: {{< url path="Cortex.GettingStarted.OnPremise.AddObservabilityToInnovation.Grafana.InstallAlloy.ConfigureAlloy" >}}
2929
[Grafana Alloy 1.10.2]: {{< url path="Grafana.Products.Loki.Alloy.1.10.2" >}}
30-
[Grafana Alloy.zip]: {{< url path="GitHub.Cortex.Observability.4.1.0.GrafanaAlloyInstallZip" >}}
30+
[Grafana Alloy.zip]: {{< url path="GitHub.Cortex.Observability.4.2.0.GrafanaAlloyInstallZip" >}}
3131
[Prerequisites]: {{< url path="Cortex.GettingStarted.OnPremise.AddObservabilityToInnovation.Grafana.Prerequisites" >}}
3232
[Reverse Proxy Authentication]: {{< url path="Cortex.GettingStarted.OnPremise.AddObservabilityToInnovation.Grafana.InstallLoki.ConfigureAuthentication" >}}

content/en/docs/2025.11/getting-started/on-premise/add-observability-to-innovation/Grafana/install-loki/configure-loki.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,25 @@ If the order is incorrect:
134134
1. Select the newly created website.
135135
1. In the *Manage Website* pane, click *Restart*.
136136

137+
## Configure Log Retention
138+
139+
Grafana Loki is configured with a default retention period of 12 months for it's logs. This means that Grafana can query data up to 12 months old. Once the 12 months is reached, Loki will remove older logs.
140+
141+
If a different retention period is required then this can be set, however, it should only be set to the period that is needed otherwise excessive disk space may be used unnecessarily.
142+
143+
To change the retention period:
144+
145+
1. Open the `loki-local-config.yaml` configuration file, which is located in the folder that Loki was installed to eg `C:\ProgramData\Cortex\Observability\Loki`.
146+
1. Locate the `retention_period:` configuration value at approximately line 55.
147+
1. Set the value of the retention required in hours, e.g. 6 months would be `4380h` or 9 months would be `6570h`.
148+
1. Save the file.
149+
150+
### Re-Start the Grafana Loki Service
151+
152+
1. Open `services.msc`.
153+
1. Locate the `Loki` service.
154+
1. Right click on the service name and select `Restart`. If the service is not already running, select `Start`.
155+
137156
## Next Steps?
138157

139158
1. [Install Grafana Alloy][]

0 commit comments

Comments
 (0)