Skip to content

Commit 282c876

Browse files
committed
Ref #32619: update Loki
1 parent f27f13d commit 282c876

File tree

5 files changed

+348
-211
lines changed

5 files changed

+348
-211
lines changed

README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,22 @@ have as password `password`). You can log into grafana
280280
on <http://grafana.shinyproxy-demo.local>, with the username and password `
281281
admin`.
282282

283-
## Further work
283+
## Upgrade to 3.1.0
284284

285-
This project could also provide a set of rules in order to set up alerting.
285+
This repository uses the same version numbers as ShinyProxy. Always use the same
286+
version of ShinyProxy and this repository.
286287

287-
**(c) Copyright Open Analytics NV, 2022.**
288+
In release 3.1.0 of this repository, all components were upgraded. In order to
289+
maintain your logs and metrics, it's important to take the following steps when
290+
updating:
291+
292+
- edit line 50
293+
of [`overlays/loki/configs/config.yaml`](overlays/loki/configs/config.yaml):
294+
change the day to be one day after you upgrade Loki. E.g. if you update this
295+
on `2024-03-25` (25 March 2024), change the date to `2024-03-26`. If you do
296+
not modify this line, you will no longer be able to access logs from before
297+
the upgrade. See
298+
the [Loki docs](https://grafana.com/docs/loki/latest/operations/storage/schema/)
299+
for more information.
300+
301+
**(c) Copyright Open Analytics NV, 2022-2024.**

bases/loki/base.yaml

Lines changed: 263 additions & 154 deletions
Large diffs are not rendered by default.

bases/loki/scripts/Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
manifest_version=2.13.3
1+
manifest_version=5.44.1
22
component=loki
33

44
outfile=../base.yaml
@@ -14,6 +14,13 @@ update:
1414
helm fetch grafana/loki --untar --untardir $(helm_dir) --version $(manifest_version)
1515
# use namespace loki here, because the namespace is hard coded in the configuration of nginx in the loki-gateway component
1616
helm template --include-crds --namespace loki --release-name dummy-release \
17+
--set singleBinary.replicas=1 --set monitoring.selfMonitoring.enabled=false \
18+
--set monitoring.selfMonitoring.grafanaAgent.installOperator=false \
19+
--set monitoring.lokiCanary.enabled=false --set test.enabled=false \
20+
--set loki.storage.type=filesystem \
21+
--set loki.commonConfig.replication_factor=1 \
22+
--set loki.auth_enabled=false \
23+
--set gateway.enabled=false \
1724
$(helm_dir)/$(component) | sed -e s/dummy-release-//g|grep -v dummy-release > $(outfile)
1825

1926
rm -rf $(helm_dir)

overlays/loki/configs/config.yaml

Lines changed: 50 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,38 @@
11
# This is based on the config file from the loki helm chart.
2-
# It was changed to set up retention for 90 days, see: https://grafana.com/docs/loki/latest/operations/storage/retention/
2+
# Modifications are commented below
33

44
auth_enabled: false
5-
chunk_store_config:
6-
max_look_back_period: 0s
7-
compactor:
8-
shared_store: filesystem
9-
working_directory: /data/loki/boltdb-shipper-compactor
10-
compaction_interval: 10m # MODIFIED
11-
retention_enabled: true # MODIFIED
12-
retention_delete_delay: 2h # MODIFIED
13-
retention_delete_worker_count: 150 # MODIFIED
14-
ingester:
15-
chunk_block_size: 262144
16-
chunk_idle_period: 3m
17-
chunk_retain_period: 1m
18-
lifecycler:
19-
ring:
20-
replication_factor: 1
21-
max_transfer_retries: 0
22-
wal:
23-
dir: /data/loki/wal
5+
common:
6+
compactor_address: 'http://loki:3100'
7+
path_prefix: /var/loki
8+
replication_factor: 1
9+
storage:
10+
filesystem:
11+
chunks_directory: /var/loki/loki/chunks
12+
rules_directory: /var/loki/rules
13+
frontend:
14+
scheduler_address: ""
15+
frontend_worker:
16+
scheduler_address: ""
17+
index_gateway:
18+
mode: ring
2419
limits_config:
25-
enforce_metric_name: false
26-
max_entries_limit_per_query: 5000
20+
max_cache_freshness_per_query: 10m
2721
reject_old_samples: true
2822
reject_old_samples_max_age: 168h
29-
retention_period: 90d # MODIFIED
30-
# split_queries_by_interval: 15m # https://github.com/grafana/loki/issues/5123#issuecomment-1167018445
31-
# max_query_parallelism: 32 # https://github.com/grafana/loki/issues/5123#issuecomment-1167018445
32-
split_queries_by_interval: 0
33-
query_range:
34-
parallelise_shardable_queries: false
35-
#query_scheduler:
36-
# max_outstanding_requests_per_tenant: 4096 # https://github.com/grafana/loki/issues/5123#issuecomment-1167018445
37-
#frontend:
38-
# max_outstanding_per_tenant: 4096 # https://github.com/grafana/loki/issues/5123#issuecomment-1167018445
23+
split_queries_by_interval: 15m
24+
# Modified to have retention of 90 days
25+
retention_period: 90d
3926
memberlist:
4027
join_members:
41-
- 'dummy-release-loki-memberlist'
28+
- loki-memberlist
29+
query_range:
30+
align_queries_with_step: true
31+
ruler:
32+
storage:
33+
type: local
34+
runtime_config:
35+
file: /etc/loki/runtime-config/runtime-config.yaml
4236
schema_config:
4337
configs:
4438
- from: "2020-10-24"
@@ -48,17 +42,30 @@ schema_config:
4842
object_store: filesystem
4943
schema: v11
5044
store: boltdb-shipper
45+
46+
# ###############################################################################
47+
# IMPORTANT: update this date to be one day after you update Loki! #
48+
# This ensures old logs are still accessible, while new logs use the new schema #
49+
# ###############################################################################
50+
- from: "2024-03-19"
51+
index:
52+
period: 24h
53+
prefix: loki_index_
54+
object_store: filesystem
55+
schema: v12
56+
store: boltdb-shipper
5157
server:
5258
grpc_listen_port: 9095
5359
http_listen_port: 3100
5460
storage_config:
55-
boltdb_shipper:
56-
active_index_directory: /data/loki/boltdb-shipper-active
57-
cache_location: /data/loki/boltdb-shipper-cache
58-
cache_ttl: 24h
59-
shared_store: filesystem
60-
filesystem:
61-
directory: /data/loki/chunks
62-
table_manager:
63-
retention_deletes_enabled: false
64-
retention_period: 0s
61+
hedging:
62+
at: 250ms
63+
max_per_second: 20
64+
up_to: 3
65+
tracing:
66+
enabled: false
67+
68+
# modified to make retention work
69+
# https://grafana.com/docs/loki/latest/setup/upgrade/#240
70+
compactor:
71+
retention_enabled: true

overlays/loki/kustomization.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ kind: Kustomization
44
namespace: loki
55

66
resources:
7-
- resources/loki.namespace.yaml
8-
- ../../bases/loki
7+
- resources/loki.namespace.yaml
8+
- ../../bases/loki
99

10-
patchesStrategicMerge:
11-
- patches/loki.statefulset.yaml
10+
configMapGenerator:
11+
- behavior: replace
12+
files:
13+
- config.yaml=configs/config.yaml
14+
name: loki
15+
namespace: loki
1216

13-
secretGenerator:
14-
- name: loki
15-
namespace: loki
16-
behavior: replace
17-
files:
18-
- loki.yaml=configs/config.yaml
17+
patches:
18+
- path: patches/loki.statefulset.yaml

0 commit comments

Comments
 (0)