From e768b1675922e746f09828920b05d836a1cd365b Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Mon, 23 Dec 2024 17:35:29 +0100 Subject: otelcol --- terraform/hash-loki/loki-config.yaml | 21 +++++++++++++++++++++ terraform/hash-loki/loki.tf | 13 ++++++++++++- terraform/hash-loki/main.tf | 4 +++- 3 files changed, 36 insertions(+), 2 deletions(-) (limited to 'terraform/hash-loki') diff --git a/terraform/hash-loki/loki-config.yaml b/terraform/hash-loki/loki-config.yaml index d21d405..72e68b0 100644 --- a/terraform/hash-loki/loki-config.yaml +++ b/terraform/hash-loki/loki-config.yaml @@ -50,3 +50,24 @@ ruler: # If you would like to disable reporting, uncomment the following lines: analytics: reporting_enabled: false + +distributor: + otlp_config: + default_resource_attributes_as_index_labels: + - cloud.availability_zone + - cloud.region + - container.name + - deployment.environment + - k8s.cluster.name + - k8s.container.name + - k8s.cronjob.name + - k8s.daemonset.name + - k8s.deployment.name + - k8s.job.name + - k8s.namespace.name + - k8s.pod.name + - k8s.replicaset.name + - k8s.statefulset.name + - service.instance.id + - service.name + - service.namespace diff --git a/terraform/hash-loki/loki.tf b/terraform/hash-loki/loki.tf index b7bb60b..1e09037 100644 --- a/terraform/hash-loki/loki.tf +++ b/terraform/hash-loki/loki.tf @@ -1,5 +1,5 @@ resource "docker_image" "loki" { - name = "grafana/loki:3.2.1" + name = "grafana/loki:3.3.0" } resource "docker_volume" "loki" { @@ -12,6 +12,10 @@ resource "docker_container" "loki" { privileged = false must_run = true + command = [ + "-config.file=${local.container_config_dir}/loki-config.yaml" + ] + network_mode = "bridge" networks_advanced { @@ -39,6 +43,13 @@ resource "docker_container" "loki" { env = [ ] + mounts { + source = local.host_config_dir + target = local.container_config_dir + type = "bind" + read_only = false + } + volumes { volume_name = docker_volume.loki.name container_path = "/loki" diff --git a/terraform/hash-loki/main.tf b/terraform/hash-loki/main.tf index a393467..7f00e45 100644 --- a/terraform/hash-loki/main.tf +++ b/terraform/hash-loki/main.tf @@ -20,7 +20,9 @@ terraform { } locals { - host = "hash.trygvis.io" + host = "hash.trygvis.io" + host_config_dir = "/etc/docker-service/loki" + container_config_dir = "/config" } provider "docker" { -- cgit v1.2.3