job "exporters" { datacenters = ["dc1"] type = "service" priority = 55 constraint { distinct_hosts = true } 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/1202 count = 2 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" config { image = "grafana/promtail:3.3.0" 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 = <