From 3dca8b3de47b1b2251b2bf9f0b4eb3be0332f06f Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sat, 27 Apr 2024 14:25:47 +0900 Subject: [PATCH 1/3] Delete unnecessary file. --- .../loki/templates/etc/loki/loki-config.yml | 45 ------------------- 1 file changed, 45 deletions(-) delete mode 100644 cookbooks/loki/templates/etc/loki/loki-config.yml diff --git a/cookbooks/loki/templates/etc/loki/loki-config.yml b/cookbooks/loki/templates/etc/loki/loki-config.yml deleted file mode 100644 index 9dc3aba..0000000 --- a/cookbooks/loki/templates/etc/loki/loki-config.yml +++ /dev/null @@ -1,45 +0,0 @@ -auth_enabled: false - -server: - http_listen_port: 3100 - -ingester: - lifecycler: - address: 127.0.0.1 - ring: - kvstore: - store: inmemory - replication_factor: 1 - final_sleep: 0s - chunk_idle_period: 5m - chunk_retain_period: 30s - max_transfer_retries: 0 - -schema_config: - configs: - - from: 2018-04-15 - store: boltdb - object_store: filesystem - schema: v11 - index: - prefix: index_ - period: 168h - -storage_config: - boltdb: - directory: /var/opt/loki/index - - filesystem: - directory: /var/opt/loki/chunks - -limits_config: - enforce_metric_name: false - reject_old_samples: true - reject_old_samples_max_age: 168h - -chunk_store_config: - max_look_back_period: 0s - -table_manager: - retention_deletes_enabled: false - retention_period: 0s From 28fea907788cbacf723602189da7f5f39753cba4 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sat, 27 Apr 2024 14:26:19 +0900 Subject: [PATCH 2/3] Update `/etc/loki/loki-config.yml`. --- cookbooks/loki/files/etc/loki/loki-config.yml | 68 ++++++++++--------- cookbooks/loki/setup.rb | 4 +- 2 files changed, 38 insertions(+), 34 deletions(-) diff --git a/cookbooks/loki/files/etc/loki/loki-config.yml b/cookbooks/loki/files/etc/loki/loki-config.yml index 9dc3aba..cdb1430 100644 --- a/cookbooks/loki/files/etc/loki/loki-config.yml +++ b/cookbooks/loki/files/etc/loki/loki-config.yml @@ -2,44 +2,50 @@ auth_enabled: false server: http_listen_port: 3100 + grpc_listen_port: 9096 -ingester: - lifecycler: - address: 127.0.0.1 - ring: - kvstore: - store: inmemory - replication_factor: 1 - final_sleep: 0s - chunk_idle_period: 5m - chunk_retain_period: 30s - max_transfer_retries: 0 +common: + instance_addr: 127.0.0.1 + path_prefix: /var/opt/loki + storage: + filesystem: + chunks_directory: /var/opt/loki/chunks + rules_directory: /var/opt/loki/rules + replication_factor: 1 + ring: + kvstore: + store: inmemory + +query_range: + results_cache: + cache: + embedded_cache: + enabled: true + max_size_mb: 100 schema_config: configs: - - from: 2018-04-15 - store: boltdb + - from: 2020-10-24 + store: tsdb object_store: filesystem - schema: v11 + schema: v13 index: prefix: index_ - period: 168h + period: 24h -storage_config: - boltdb: - directory: /var/opt/loki/index +frontend: + encoding: protobuf - filesystem: - directory: /var/opt/loki/chunks +# By default, Loki will send anonymous, but uniquely-identifiable usage and configuration +# analytics to Grafana Labs. These statistics are sent to https://stats.grafana.org/ +# +# Statistics help us better understand how Loki is used, and they show us performance +# levels for most users. This helps us prioritize features and documentation. +# For more information on what's sent, look at +# https://github.com/grafana/loki/blob/main/pkg/analytics/stats.go +# Refer to the buildReport method to see what goes into a report. +# +# If you would like to disable reporting, uncomment the following lines: +#analytics: +# reporting_enabled: false -limits_config: - enforce_metric_name: false - reject_old_samples: true - reject_old_samples_max_age: 168h - -chunk_store_config: - max_look_back_period: 0s - -table_manager: - retention_deletes_enabled: false - retention_period: 0s diff --git a/cookbooks/loki/setup.rb b/cookbooks/loki/setup.rb index 591e83e..6c5f27b 100644 --- a/cookbooks/loki/setup.rb +++ b/cookbooks/loki/setup.rb @@ -8,13 +8,11 @@ end # Deploy `prometheus` files: -template '/etc/loki/loki-config.yml' do +remote_file '/etc/loki/loki-config.yml' do owner 'root' group 'root' mode '644' - variables(ipaddr: node['loki']['ipaddr']) - notifies :restart, 'service[loki]' end From 2da188f298ea8728eb9dd1d9401e7301061a0d6e Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sat, 27 Apr 2024 14:29:44 +0900 Subject: [PATCH 3/3] Modify the retention period from 24h to 240h. --- cookbooks/loki/files/etc/loki/loki-config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbooks/loki/files/etc/loki/loki-config.yml b/cookbooks/loki/files/etc/loki/loki-config.yml index cdb1430..76b6b2a 100644 --- a/cookbooks/loki/files/etc/loki/loki-config.yml +++ b/cookbooks/loki/files/etc/loki/loki-config.yml @@ -31,7 +31,7 @@ schema_config: schema: v13 index: prefix: index_ - period: 24h + period: 240h frontend: encoding: protobuf