infrastructure/ingress.tjo.cloud/root/etc/alloy/config.alloy
Tine f72f4284f3
Some checks are pending
/ lint (push) Waiting to run
feat: merge multiple infrastructure repos
2024-12-22 21:11:02 +01:00

109 lines
2.5 KiB
Text

logging {
level = "info"
format = "logfmt"
}
//===
// Metrics
//===
prometheus.exporter.self "default" {
}
prometheus.exporter.unix "default" {
}
prometheus.scrape "exporters" {
targets = concat(
prometheus.exporter.self.default.targets,
prometheus.exporter.unix.default.targets,
)
forward_to = [
otelcol.receiver.prometheus.default.receiver,
]
}
//===
// Logs
//===
loki.relabel "journal" {
forward_to = []
rule {
source_labels = ["__journal__systemd_unit"]
target_label = "journal_unit"
}
}
loki.source.journal "default" {
forward_to = [loki.process.drop_old.receiver]
relabel_rules = loki.relabel.journal.rules
}
loki.process "drop_old" {
stage.drop {
older_than = "1h"
drop_counter_reason = "too old"
}
forward_to = [
otelcol.receiver.loki.default.receiver,
]
}
//===
// OTEL
//===
otelcol.receiver.prometheus "default" {
output {
metrics = [otelcol.processor.attributes.default.input]
}
}
otelcol.receiver.loki "default" {
output {
logs = [otelcol.processor.attributes.default.input]
}
}
otelcol.processor.attributes "default" {
output {
metrics = [otelcol.processor.resourcedetection.default.input]
logs = [otelcol.processor.resourcedetection.default.input]
traces = [otelcol.processor.resourcedetection.default.input]
}
}
otelcol.processor.resourcedetection "default" {
detectors = ["env", "system"]
system {
hostname_sources = ["os"]
resource_attributes {
host.arch { enabled = true }
host.id { enabled = true }
host.name { enabled = true }
os.type { enabled = true }
}
}
output {
metrics = [otelcol.processor.batch.default.input]
logs = [otelcol.processor.batch.default.input]
traces = [otelcol.processor.batch.default.input]
}
}
otelcol.processor.batch "default" {
timeout = "10s"
output {
metrics = [otelcol.exporter.otlp.default.input]
logs = [otelcol.exporter.otlp.default.input]
traces = [otelcol.exporter.otlp.default.input]
}
}
otelcol.auth.oauth2 "default" {
token_url = "https://id.tjo.space/application/o/token/"
client_id = "Vlw69HXoTJn1xMQaDX71ymGuLVoD9d2WxscGhksh"
client_secret = "none"
endpoint_params = {
grant_type = ["client_credentials"],
username = [env("ALLOY_USERNAME")],
password = [env("ALLOY_PASSWORD")],
}
}
otelcol.exporter.otlp "default" {
client {
endpoint = "grpc.otel.monitor.tjo.cloud:443"
auth = otelcol.auth.oauth2.default.handler
}
}