Skip to content

Latest commit

 

History

History
75 lines (62 loc) · 2.23 KB

README.rst

File metadata and controls

75 lines (62 loc) · 2.23 KB

OpenTelemetry Logs SDK

Start the Collector locally to see data being exported. Write the following file:

# otel-collector-config.yaml
receivers:
    otlp:
        protocols:
            grpc:

exporters:
    logging:

processors:
    batch:

Then start the Docker container:

docker run \
    -p 4317:4317 \
    -v $(pwd)/otel-collector-config.yaml:/etc/otel/config.yaml \
    otel/opentelemetry-collector-contrib:latest
$ python example.py

The resulting logs will appear in the output from the collector and look similar to this:

ResourceLog #0
Resource labels:
     -> telemetry.sdk.language: STRING(python)
     -> telemetry.sdk.name: STRING(opentelemetry)
     -> telemetry.sdk.version: STRING(1.5.0.dev0)
     -> service.name: STRING(unknown_service)
InstrumentationLibraryLogs #0
InstrumentationLibrary __main__ 0.1
LogRecord #0
Timestamp: 2021-08-18 08:26:53.837349888 +0000 UTC
Severity: ERROR
ShortName:
Body: Exception while exporting logs.
ResourceLog #1
Resource labels:
     -> telemetry.sdk.language: STRING(python)
     -> telemetry.sdk.name: STRING(opentelemetry)
     -> telemetry.sdk.version: STRING(1.5.0.dev0)
     -> service.name: STRING(unknown_service)
InstrumentationLibraryLogs #0
InstrumentationLibrary __main__ 0.1
LogRecord #0
Timestamp: 2021-08-18 08:26:53.842546944 +0000 UTC
Severity: ERROR
ShortName:
Body: The five boxing wizards jump quickly.
ResourceLog #2
Resource labels:
     -> telemetry.sdk.language: STRING(python)
     -> telemetry.sdk.name: STRING(opentelemetry)
     -> telemetry.sdk.version: STRING(1.5.0.dev0)
     -> service.name: STRING(unknown_service)
InstrumentationLibraryLogs #0
InstrumentationLibrary __main__ 0.1
LogRecord #0
Timestamp: 2021-08-18 08:26:53.843979008 +0000 UTC
Severity: ERROR
ShortName:
Body: Hyderabad, we have a major problem.