concepts / log-json-schema / contexts

Log Event JSON Schema - context

The Timber log event JSON schema defines a root level context key the contains a JSON document. It represents the environment the log was written and is shared across your log lines. Think of it like log join data. It's incredibly powerful, allowing you related logs and perform tasks like tailing users or tracing HTTP requests. It's available sub-keys are:

  1. context.custom
  2. context.http
  3. context.job
  4. context.release
  5. context.runtime
  6. context.system
  7. context.user

Example JSON structure

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{
  // ...
  "context": {
    "http": {
      "method": "GET",
      "path": "/checkout",
      "remote_addr": "123.456.789.10",
      "request_id": "abcd1234"
    },
    "user": {
      "id": 2,
      "name": "Ben Johnson",
      "email": "ben@johnson.com"
    }
  }
  // ...
}
Questions?

Chat with us, just click the talk button in the bottom right of this page.

Chat with us
Sign Up

Log better and solve problems faster, today. Install in under a minute.

Sign Up