Logging with context
Logging is probably the most familiar form of telemetry. You probably started logging in the first program you ever authored when you printed Hello World!
to STDOUT
. Logging is the most natural first step in providing some data about the internal state of an application to an observer. Think about how many times you have added a print statement to your application to determine the value of a variable. You were logging.
Printing simple log statements such as Hello World!
can be helpful for beginners, but it does not provide the critical data we require to operate complex systems. Logs can be powerful sources of telemetry data when they are enriched with data to provide context for the events they are describing. For example, if our log statements include a correlation ID in the log entry, we can use that data to associate the log entry with other observability data.
Application or system logs often consist of timestamped text records. These records come in...