Skip to content

Commit

Permalink
fix loki
Browse files Browse the repository at this point in the history
  • Loading branch information
bodsch committed Jul 13, 2024
1 parent e2a2d33 commit a451c32
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions roles/loki/templates/loki/loki.d/storage_config.j2
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,22 @@ storage_config:
{% endfor %}
{% if loki_config_storage.boltdb_shipper.index_gateway_client is defined and
loki_config_storage.boltdb_shipper.index_gateway_client | count > 0 %}
index_gateway_client:
{% if loki_config_storage.boltdb_shipper.index_gateway_client.server_address is defined and
loki_config_storage.boltdb_shipper.index_gateway_client.server_address | string | length > 0 %}
server_address: {{ loki_config_storage.boltdb_shipper.index_gateway_client.server_address }}
{% endif %}
{% if loki_config_storage.boltdb_shipper.index_gateway_client.log_gateway_requests is defined %}
log_gateway_requests: {{ loki_config_storage.boltdb_shipper.index_gateway_client.log_gateway_requests | bool | bodsch.core.config_bool(true_as='true', false_as='false') }}
{% set valid_keys = [
"server_address",
"log_gateway_requests"] %}
{% if loki_main_version is version_compare("2.5", operator='>') %}
{% set indx = valid_keys.index('log_gateway_requests') %}
{% set _ = valid_keys.pop(indx) %}
{% endif %}
index_gateway_client:
{% for key, v in loki_config_querier.items() %}
{% if key in valid_keys %}
{% set value = v | bodsch.grafana.loki_value %}
{% if value %}
{{ key }}: {{ value }}
{% endif %}
{% endif %}
{% endfor %}
{% if loki_config_storage.boltdb_shipper.index_gateway_client.grpc_client_config is defined and
loki_config_storage.boltdb_shipper.index_gateway_client.grpc_client_config | count > 0 %}
grpc_client_config:
Expand Down

0 comments on commit a451c32

Please sign in to comment.