Skip to content

Add Node Identification to Log Lines #307

@alexluong

Description

@alexluong

Add a unique identifier for each service instance to log lines to help with debugging in multi-node deployments. Consider using standard fields like hostname or container ID, or environment variables that work across different deployment methods (not k8s specific). This will make it easier to trace issues across logs when running multiple instances of the same service.

os.Hostname() provides a reliable node identifier across most modern deployment platforms:

  • Kubernetes: returns pod name (e.g. outpost-api-5bbd447f65-x2444)
  • Docker: returns container ID
  • Cloud VMs: returns instance hostname (usually includes instance ID)
  • ECS: returns task/container ID

Cases where hostname alone might not be sufficient:

  1. Bare metal/VMs with generic hostnames (web-01, web-02)
  2. Local development running multiple instances on same host
  3. Platforms that allow hostname customization which might break uniqueness

For our current deployment targets, os.Hostname() should be sufficient as a node identifier. We can revisit if we encounter specific use cases where the hostname doesn't provide enough context for debugging.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions