plugin "docker" {
config {
extra_labels = ["job_name", "job_id", "task_group_name", "task_name", "namespace", "node_name", "node_id"]
logging {
type = "fluentd"
config {
fluentd-address = "localhost:24224"
tag = "tag"
labels = "job_name,job_id,task_group_name,task_name,namespace,node_name,node_id"
}
}
}
}
The above is part of my client agent configuration in nomad for configuring the docker plugin. For some reason, only the logs are sent and no nomad metadata.
But the following task specification in my nomad config file works just fine. The logs are sent with nomad metadata.
task "..." {
driver = "docker"
config {
image = "..."
args = ["--loglevel", "debug"]
ports = ["https"]
labels {
job_name = "${NOMAD_JOB_NAME}"
job_id = "${NOMAD_JOB_ID}"
task_group_name = "${NOMAD_GROUP_NAME}"
task_name = "${NOMAD_TASK_NAME}"
namespace = "${NOMAD_NAMESPACE}"
node_name = "${node.unique.name}"
node_id = "${node.unique.id}"
}
logging {
type = "fluentd"
config {
fluentd-address = "localhost:24224"
tag = "tag"
labels = "job_name,job_id,task_group_name,task_name,namespace,node_name,node_id"
}
}
}
}
Both of them send logs to the same fluentd with the same fluentd config.
Can anybody help and tell me what I need to change so the plugin approach works?
Thank you!