OpenTelemetry does not provide a dedicated logging API nor libraries for creating logs right now. There are mature libraries which do that already and support for those projects is planned instead. Most probably that will be an appender which will correlate logs with traces.
How to create simple logs
Standard libraries for programming languages provide simple logging capabilites out of the box. You can use them to create logs. If your application follows The Twelve-Factor App standard "it should write its logs, unbuffered, to
Later, the execution environment like systemd, Docker or Kubernetes takes care of routing this event stream to the local file or sending to other systems like Sumo Logic directly.
If your application logs are written to the local file they can be collected by OpenTelemetry Collector for further processing.
You can find more on that topic in the OpenTelemetry Collector / Logs section.
Let's assume that your application writes logs to
stdout and runs inside a
As a result, by default on a Linux machine those logs are written to the
The log file from Docker container can be scraped by the OpenTelemetry Collector with the help of filelogreceiver. This receiver will tail the log file and for each line emit a new record for further processing inside the OpenTelemetry Collector. It will also attach a
file name metadata to this record.
Correlating logs and traces
When you use the OpenTelemetry appender for logging library you can correlate logs with traces.