node package manager


Generate a string for a process that can be used in logging

Timber Hitch

Build Status

A tiny module to generate a logging key, exposing the hostname, process id and an optional component name.

It is designed to be used where multiple node processes are running behind a load balancer logging to a central location.

The generated key looks like this


This includes

  • hostname for the process
  • process id

Or this if you include a component name


This includes

  • the component name
  • hostname for the process
  • process id


npm install timberhitch


You can pass an optional component name if you wish to include that in your logging key.

var timberhitch = require('timberhitch');

> orwell.local:13691

var timberhitch = require('timberhitch');

> compenent:orwell.local:28984

You can use it with any library through string concatenation.

var winston = require('winston'),
  timberhitch = require('timberhitch'),
  loggingKey = timberhitch(); + 'some log message');

> info: orwell.local:13691 some log message