85 lines
1.8 KiB
Plaintext
85 lines
1.8 KiB
Plaintext
|
// Sample config for Alloy.
|
||
|
//
|
||
|
// For a full configuration reference, see https://grafana.com/docs/dev-packages
|
||
|
logging {
|
||
|
level = "warn"
|
||
|
}
|
||
|
|
||
|
prometheus.exporter.unix "default" {
|
||
|
include_exporter_metrics = true
|
||
|
disable_collectors = ["mdadm"]
|
||
|
}
|
||
|
|
||
|
prometheus.scrape "default" {
|
||
|
targets = array.concat(
|
||
|
prometheus.exporter.unix.default.targets,
|
||
|
[{
|
||
|
// Self-collect metrics
|
||
|
job = "dev-packages",
|
||
|
__address__ = "127.0.0.1:12345",
|
||
|
group = "infrastructure",
|
||
|
}],
|
||
|
)
|
||
|
|
||
|
forward_to = [
|
||
|
// TODO: components to forward metrics to (like prometheus.remote_write or
|
||
|
// prometheus.relabel).
|
||
|
prometheus.remote_write.default.receiver,
|
||
|
]
|
||
|
}
|
||
|
|
||
|
prometheus.remote_write "default" {
|
||
|
external_labels = {
|
||
|
"node" = "{{ node_name }}",
|
||
|
}
|
||
|
|
||
|
endpoint {
|
||
|
url = "https://prometheus.i.kjuulh.io/api/v1/write"
|
||
|
}
|
||
|
}
|
||
|
|
||
|
local.file_match "local_files" {
|
||
|
path_targets = [{"__path__" = "/var/log/*.log"}]
|
||
|
sync_period = "5s"
|
||
|
}
|
||
|
|
||
|
loki.source.file "log_scrape" {
|
||
|
targets = local.file_match.local_files.targets
|
||
|
forward_to = [loki.process.filter_logs.receiver]
|
||
|
tail_from_end = true
|
||
|
}
|
||
|
|
||
|
loki.source.journal "default" {
|
||
|
forward_to = [loki.process.filter_logs.receiver]
|
||
|
}
|
||
|
|
||
|
discovery.docker "linux" {
|
||
|
host = "unix:///var/run/docker.sock"
|
||
|
}
|
||
|
|
||
|
loki.source.docker "default" {
|
||
|
host = "unix:///var/run/docker.sock"
|
||
|
targets = discovery.docker.linux.targets
|
||
|
labels = {"app" = "docker"}
|
||
|
forward_to = [loki.write.grafana_loki.receiver]
|
||
|
}
|
||
|
|
||
|
loki.process "filter_logs" {
|
||
|
stage.drop {
|
||
|
source = ""
|
||
|
expression = ".*Connection closed by authenticating user root"
|
||
|
drop_counter_reason = "noisy"
|
||
|
}
|
||
|
forward_to = [loki.write.grafana_loki.receiver]
|
||
|
}
|
||
|
|
||
|
loki.write "grafana_loki" {
|
||
|
external_labels = {
|
||
|
"node" = "{{ node_name }}",
|
||
|
}
|
||
|
|
||
|
endpoint {
|
||
|
url = "https://loki.i.kjuulh.io/loki/api/v1/push"
|
||
|
}
|
||
|
}
|