-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
203 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
// Configuration file | ||
local.file "endpoints" { | ||
// The endpoints file is used to define the endpoints, credentials and options | ||
// for the Alloy export to. | ||
filename = "/etc/alloy/endpoints.json" | ||
} | ||
|
||
discovery.docker "docker" { | ||
host = "unix:///var/run/docker.sock" | ||
refresh_interval = "5s" | ||
} | ||
|
||
loki.process "docker" { | ||
forward_to = [loki.write.default.receiver] | ||
|
||
stage.docker { } | ||
} | ||
|
||
discovery.relabel "docker" { | ||
targets = [] | ||
|
||
rule { | ||
source_labels = ["__meta_docker_container_label_app"] | ||
regex = ".+" | ||
action = "keep" | ||
} | ||
|
||
rule { | ||
source_labels = ["__meta_docker_container_label_app"] | ||
target_label = "app" | ||
action = "replace" | ||
} | ||
|
||
rule { | ||
target_label = "job" | ||
replacement = "docker" | ||
} | ||
} | ||
|
||
loki.source.docker "docker" { | ||
host = "unix:///var/run/docker.sock" | ||
targets = discovery.docker.docker.targets | ||
forward_to = [loki.process.docker.receiver] | ||
relabel_rules = discovery.relabel.docker.rules | ||
refresh_interval = "5s" | ||
} | ||
|
||
loki.write "default" { | ||
// Output the Loki log to the Loki instance. | ||
endpoint { | ||
url = json_path(local.file.endpoints.content, ".logs.url")[0] | ||
|
||
// The basic auth credentials for the Loki instance. | ||
basic_auth { | ||
username = json_path(local.file.endpoints.content, ".logs.basicAuth.username")[0] | ||
password = json_path(local.file.endpoints.content, ".logs.basicAuth.password")[0] | ||
} | ||
} | ||
} | ||
|
||
discovery.docker "prometheus" { | ||
host = "unix:///var/run/docker.sock" | ||
refresh_interval = "5s" | ||
} | ||
|
||
discovery.relabel "prometheus" { | ||
targets = discovery.docker.prometheus.targets | ||
|
||
rule { | ||
source_labels = ["__meta_docker_container_label_metrics_enabled"] | ||
regex = ".+" | ||
action = "keep" | ||
} | ||
|
||
rule { | ||
source_labels = ["__meta_docker_container_label_app"] | ||
target_label = "app" | ||
action = "replace" | ||
} | ||
} | ||
|
||
prometheus.scrape "prometheus" { | ||
targets = discovery.relabel.prometheus.output | ||
forward_to = [prometheus.remote_write.default.receiver] | ||
job_name = "prometheus" | ||
scrape_interval = "15s" | ||
} | ||
|
||
prometheus.remote_write "default" { | ||
// Output the Prometheus metrics to the Prometheus instance. | ||
endpoint { | ||
url = json_path(local.file.endpoints.content, ".metrics.url")[0] | ||
|
||
// The basic auth credentials for the Prometheus instance. | ||
basic_auth { | ||
username = json_path(local.file.endpoints.content, ".metrics.basicAuth.username")[0] | ||
password = json_path(local.file.endpoints.content, ".metrics.basicAuth.password")[0] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"metrics": { | ||
"url": "https://prometheus-prod-link.grafana.net/api/prom/push", | ||
"basicAuth": { | ||
"username": "username", | ||
"password": "password" | ||
} | ||
}, | ||
"logs": { | ||
"url": "https://logs-prod-link.grafana.net/loki/api/v1/push", | ||
"basicAuth": { | ||
"username": "username", | ||
"password": "password" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters