job "exporters" { datacenters = ["dc1"] type = "service" priority = 55 group "promtail" { # TODO: This must be updated to match the nubmer of servers (possibly grabbed from TF) # I am moving away from `system` jobs because of https://github.com/hashicorp/nomad/issues/12023 count = 3 network { mode = "bridge" port "promtail" { %{~ if use_wesher ~} host_network = "wesher" %{~ endif ~} to = 9080 } } service { name = "promtail" provider = "nomad" port = "promtail" meta { nomad_dc = "$${NOMAD_DC}" nomad_node_name = "$${node.unique.name}" } tags = [ "prometheus.scrape", ] } 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.9.1" args = ["-config.file=$${NOMAD_TASK_DIR}/promtail.yml"] ports = ["promtail"] # 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 = <