BossaBox

This is the playbook for engineering-playbook

Logging

Overview

Logs are discrete events with the goal of helping engineers identify problem area(s) during failures.

Collection Methods

When it comes to log collection methods, two of the standard techniques are a direct-write, or an agent-based approach.

Directly written log events are handled in-process of the particular component, usually utilizing a provided library. Azure Monitor has direct send capabilities, but it’s not recommended for serious/production use. This approach has some advantages:

The potential trade-offs of this approach:

Agent-based log collection relies on an external process running on the host machine, with the particular component emitting log data stdout or file. Writing log data to stdout is the preferred practice when running applications within a container environment like Kubernetes. The container runtime redirects the output to files, which can then be processed by an agent. Azure Monitor, Grafana Loki Elastic’s Logstash and Fluent Bit are examples of log shipping agents.

There are several advantages when using an agent to collect & ship log files:

This approach isn’t without trade-offs:

Best Practices

If there’s sufficient log data, is there a need for instrumenting metrics?

Logs vs Metrics vs Traces covers some high level guidance on when to utilize metric data and when to use log data. Both have a valuable part to play in creating observable systems.

Having problems identifying what to log?

At application startup:

Per incoming request:

Per outgoing request: