2025-03-01 01:01:40 +00:00
|
|
|
/*
|
2025-03-01 00:52:56 +00:00
|
|
|
logging {
|
|
|
|
|
level = "debug" # or even "trace" for more detail
|
|
|
|
|
format = "logfmt" # or "json" for structured logging
|
|
|
|
|
}
|
2025-03-01 00:38:42 +00:00
|
|
|
|
|
|
|
|
local.file_match "local_files" {
|
|
|
|
|
path_targets = [
|
|
|
|
|
{"__path__" = "/var/log/sourcebot/*.log"}
|
|
|
|
|
]
|
|
|
|
|
sync_period = "5s"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
loki.source.file "log_scrape" {
|
|
|
|
|
targets = local.file_match.local_files.targets
|
2025-03-01 00:49:09 +00:00
|
|
|
forward_to = [loki.process.filter_logs.receiver]
|
2025-03-01 00:38:42 +00:00
|
|
|
tail_from_end = true
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-01 00:49:09 +00:00
|
|
|
loki.process "filter_logs" {
|
|
|
|
|
stage.drop {
|
|
|
|
|
source = ""
|
|
|
|
|
expression = ""
|
|
|
|
|
drop_counter_reason = "noisy"
|
|
|
|
|
}
|
|
|
|
|
forward_to = [loki.write.grafana_loki.receiver]
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-01 00:38:42 +00:00
|
|
|
loki.write "grafana_loki" {
|
|
|
|
|
endpoint {
|
2025-03-01 00:58:14 +00:00
|
|
|
url = sys.env("GRAFANA_LOKI_ENDPOINT")
|
2025-03-01 00:38:42 +00:00
|
|
|
|
|
|
|
|
basic_auth {
|
|
|
|
|
username = sys.env("GRAFANA_USERNAME")
|
|
|
|
|
password = sys.env("GRAFANA_PASSWORD")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-03-01 01:01:40 +00:00
|
|
|
*/
|
2025-03-01 00:38:42 +00:00
|
|
|
|
2025-02-25 05:11:28 +00:00
|
|
|
prometheus.scrape "local_app" {
|
|
|
|
|
targets = [
|
|
|
|
|
{
|
|
|
|
|
__address__ = "localhost:6070",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
__address__ = "localhost:3060",
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
metrics_path = "/metrics"
|
2025-02-25 23:49:09 +00:00
|
|
|
scrape_timeout = "500ms"
|
|
|
|
|
scrape_interval = "500ms"
|
2025-02-25 05:11:28 +00:00
|
|
|
|
|
|
|
|
job_name = sys.env("GRAFANA_ENVIRONMENT")
|
|
|
|
|
|
|
|
|
|
forward_to = [
|
|
|
|
|
prometheus.remote_write.grafana_cloud.receiver,
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
prometheus.remote_write "grafana_cloud" {
|
|
|
|
|
endpoint {
|
|
|
|
|
url = sys.env("GRAFANA_ENDPOINT")
|
|
|
|
|
|
|
|
|
|
basic_auth {
|
|
|
|
|
username = sys.env("GRAFANA_USERNAME")
|
|
|
|
|
password = sys.env("GRAFANA_PASSWORD")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|