languages / ruby / usage / custom-events

Ruby Usage - Custom Events

Custom events allow you to extend beyond events already defined in the Timber::Events namespace. If you aren't sure what an event is, please read the "Metdata, Context, and Events" doc.

How to use it

1
logger.warn "Payment rejected", payment_rejected: {customer_id: "abcd1234", amount: 100, reason: "Card expired"}
  1. Search it with queries like: type:payment_rejected or payment_rejected.amount:>100
  2. Alert on it with threshold based alerts
  3. Graph & visualize it
  4. View this event's data and context

How it works

When this event is received by the Timber service we'll define a namespaced schema based on the event name. In this case, the namespace would be payment_rejected. The data structure of your log will look like:

1
2
3
4
5
6
7
8
9
10
11
12
13
{
  "message": "Payment rejected",
  "level": "warn",
  "event": {
    "custom": {
      "payment_rejected": {
        "customer_id": "abcd1234",
        "amount": 100,
        "reason": "Card expired"
      }
    }
  }
}
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