diff --git a/grafana-alloy/config.central-template.alloy b/grafana-alloy/config.central-template.alloy new file mode 100644 index 0000000..d1f1160 --- /dev/null +++ b/grafana-alloy/config.central-template.alloy @@ -0,0 +1,85 @@ +logging { + level = "debug" + format = "logfmt" +} + +// Receivers +otelcol.receiver.otlp "otlp_receiver" { + grpc { + endpoint = "127.0.0.1:4317" + } + http { + endpoint = "127.0.0.1:4318" + } + + output { + logs = [otelcol.processor.batch.default.input] + traces = [otelcol.processor.batch.default.input] + } +} + +otelcol.processor.batch "default" { + output { + logs = [otelcol.exporter.loki.default.input] + traces = [otelcol.processor.attributes.custom_labels.input] + } +} + +otelcol.processor.attributes "custom_labels" { + action { + key = "host" + action = "insert" + // Insert host name here: + value = "{HOSTNAME}" + } + output { + traces = [otelcol.exporter.otlp.sov_tempo.input] + } +} + +// Exporters + +// Tempo +otelcol.exporter.otlp "sov_tempo" { + client { + endpoint = "{TEMPO_HOST}" + auth = otelcol.auth.basic.sov_tempo.handler + } +} + +otelcol.auth.basic "sov_tempo" { + username = "{ALLOY_USER}" + password = "{ALLOY_PASSWORD}" +} + + +// OTLP -> Loki +otelcol.exporter.loki "default" { + forward_to = [ + loki.process.add_hostname.receiver, + ] +} + +loki.process "add_hostname" { + forward_to = [ + loki.write.sov_loki.receiver, + ] + + stage.static_labels { + values = { + host = "{HOSTNAME}", + } + } +} + +// Sovereign Loki +loki.write "sov_loki" { + endpoint { + url = "https://{LOKI_HOST}/loki/api/v1/push" + + basic_auth { + username = "{ALLOY_USER}" + password = "{ALLOY_PASSWORD}" + } + } +} diff --git a/grafana-alloy/config.cloud.alloy b/grafana-alloy/config.cloud.alloy index 09d8c8e..5cd0a81 100644 --- a/grafana-alloy/config.cloud.alloy +++ b/grafana-alloy/config.cloud.alloy @@ -6,10 +6,10 @@ logging { // Receivers otelcol.receiver.otlp "otlp_receiver" { grpc { - endpoint = "0.0.0.0:4317" + endpoint = "127.0.0.1:4317" } http { - endpoint = "0.0.0.0:4318" + endpoint = "127.0.0.1:4318" } output { @@ -48,8 +48,8 @@ otelcol.exporter.otlp "grafanacloud" { // Tempo: auth otelcol.auth.basic "grafanacloud" { - username = "1071746" - password = "glc_1" + username = "1071746" + password = "glc_1" } // OTLP -> Loki