Hi,
I wanna enrich each job log with the current job status as metadata. I know that the job status can change through its lifecyle. I thought of assigning an environment variable to a docker label but there is no environment variable that holds the job status. Therefore I think I need another approach to dynamically assign the job status to each job log.
Does anybody can help me and give me tips on how I could manage to achieve that?
In the following my job file:
job "redis" {
datacenters = ["dc1"]
type = "service"
group "cache" {
task "redis" {
driver = "docker"
config {
image = "redis"
port_map {
db = 6379
}
labels {
job_status = "${NOMAD_JOB_STATUS}" # env variable NOMAD_JOB_STATUS does not exist
}
logging {
type = "fluentd"
config {
fluentd-address = "localhost:24224"
tag = "tag"
labels = "job_status"
}
}
}
resources {
cpu = 500 # 500 MHz
memory = 256 # 256MB
network {
mbits = 10
port "db" {}
}
}
}
}
}