ingress/root/etc/alloy/config.alloy

107 lines
2.5 KiB
Text
Raw Normal View History

2024-09-19 18:42:30 +00:00
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.source.journal "default" {
forward_to = [loki.process.drop_old.receiver]
}
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"]
output {
metrics = [otelcol.processor.transform.default.input]
logs = [otelcol.processor.transform.default.input]
traces = [otelcol.processor.transform.default.input]
}
}
otelcol.processor.transform "default" {
error_mode = "ignore"
metric_statements {
context = "datapoint"
statements = [
`set(attributes["node"], resource.attributes["node"])`,
]
}
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
}
}