hashicorp / hashicorp/nomad

Add Container Name to info logging

Open
#11,352 0 comments 3 reactions 0 assignees View on GitHub
stage/accepted theme/logging type/enhancement
Dominant language
Go
Stars
17k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
105

Description

### Proposal
Today Nomad logs detailed container ID information to logs
```
{
"@level":"info",
"@message":"started container",
"@module":"client.driver_mgr.docker",
"@timestamp":"2021-10-20T18:06:59.240328Z",
"container_id":"573a839bc9f88e16549505868a97015feb0ed825981836c2a45cead6c2f4d73c",
"driver":"docker"
}
```

This is helpful to pin point the exact container but it's also quite tricky to track down the real source of a problem (say a particular container set restarting). It would be great if we could also have the container name printed in the logs as a new field. So, using the above as an example

```
{
"@level":"info",
"@message":"started container",
"@module":"client.driver_mgr.docker",
"@timestamp":"2021-10-20T18:06:59.240328Z",
"container_id":"573a839bc9f88e16549505868a97015feb0ed825981836c2a45cead6c2f4d73c",
"container_name":"client-side-load-balancer-linux-99845135-a4a5-08af-c5d3-6bbb363b1ef1",
"driver":"docker"
}
```

Without this it requires some "stitching together" across log entries that may be far apart in time. This would simplify our user and debugging experiences, as well as help observability of our processes/containers

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names Nomad’s Docker driver and the “started container” info log but no file or test. Start by locating that log entry and the available container metadata; done means the log includes a container_name field alongside container_id, matching the requested example.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
observability
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.