job "metrics" { datacenters = ["dc1"] type = "system" group "promtail" { network { mode = "bridge" port "promtail" { to = 9080 } } service { name = "promtail" port = "promtail" meta { metrics_addr = "${NOMAD_ADDR_promtail}" nomad_dc = "${NOMAD_DC}" nomad_node_name = "${node.unique.name}" } connect { sidecar_service { proxy { local_service_port = 9080 upstreams { destination_name = "loki" local_bind_port = 1000 } } } sidecar_task { resources { cpu = 50 memory = 20 } } } check { type = "http" path = "/metrics" port = "promtail" interval = "10s" timeout = "10s" } } task "promtail" { driver = "docker" meta = { "diun.sort_tags" = "semver" "diun.watch_repo" = true "diun.include_tags" = "^[0-9]+\\.[0-9]+\\.[0-9]+$" } config { image = "grafana/promtail:2.7.1" args = ["-config.file=/etc/promtail/promtail.yml"] ports = ["promtail"] # Mount config mount { type = "bind" target = "/etc/promtail/promtail.yml" source = "local/promtail.yml" } # Bind mount host machine-id and log directories mount { type = "bind" source = "/etc/machine-id" target = "/etc/machine-id" readonly = true } mount { type = "bind" source = "/var/log/journal/" target = "/var/log/journal/" readonly = true } mount { type = "bind" source = "/run/log/journal/" target = "/run/log/journal/" readonly = true } # mount { # type = "bind" # source = "/var/log/audit" # target = "/var/log/audit" # readonly = true # } } template { data = <