Sending Logs
All logs are received over OTLP/HTTP at http://<your-ip>:4318. Replace <your-ip>
with the address of the machine running the stack (use localhost if it's the same machine).
Quick test with telemetrygen
Generate synthetic logs without touching your app — useful to confirm the pipeline works end to end:
docker run --rm \
--network xplurdata_otel-net \
ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:latest \
logs \
--otlp-endpoint otel-collector:4318 \
--otlp-http \
--otlp-insecure \
--duration 10s \
--rate 100 \
--service my-service
Within a few seconds you should see records appear in the Web UI.
Send logs from your application
Every OpenTelemetry SDK reads the same standard environment variables. Set these once and the SDK exports to your stack:
export OTEL_EXPORTER_OTLP_ENDPOINT="http://<your-ip>:4318"
export OTEL_EXPORTER_OTLP_PROTOCOL="http/protobuf"
export OTEL_SERVICE_NAME="my-service"
export OTEL_LOGS_EXPORTER="otlp"
Then wire up the SDK for your language:
- Python
- Node.js
- Java
- Go
- .NET
- Ruby
- PHP
- Rust
pip install opentelemetry-distro opentelemetry-exporter-otlp
opentelemetry-bootstrap -a install
Run your app with auto-instrumentation — logs, traces, and metrics export automatically:
opentelemetry-instrument python app.py
npm install @opentelemetry/api \
@opentelemetry/auto-instrumentations-node \
@opentelemetry/exporter-logs-otlp-http
node --require @opentelemetry/auto-instrumentations-node/register app.js
Download the OpenTelemetry Java agent and attach it at startup — zero code changes:
curl -L -o opentelemetry-javaagent.jar \
https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar
java -javaagent:./opentelemetry-javaagent.jar -jar app.jar
go get go.opentelemetry.io/otel \
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp \
go.opentelemetry.io/otel/sdk/log
Initialise the OTLP log exporter from the OTEL_EXPORTER_OTLP_ENDPOINT env var and attach
it to a log.LoggerProvider in your main().
dotnet add package OpenTelemetry.Extensions.Hosting
dotnet add package OpenTelemetry.Exporter.OpenTelemetryProtocol
Register OpenTelemetry logging in Program.cs with .AddOtlpExporter(); it reads the
standard OTEL_* environment variables.
bundle add opentelemetry-sdk opentelemetry-exporter-otlp opentelemetry-instrumentation-all
Call OpenTelemetry::SDK.configure { |c| c.use_all } during boot; the OTLP exporter
picks up the OTEL_* env vars.
composer require open-telemetry/sdk open-telemetry/exporter-otlp
Configure the OTLP log exporter pointing at OTEL_EXPORTER_OTLP_ENDPOINT.
# Cargo.toml
[dependencies]
opentelemetry = "0.24"
opentelemetry-otlp = { version = "0.17", features = ["logs", "http-proto"] }
opentelemetry_sdk = { version = "0.24", features = ["logs"] }
Build an OTLP log exporter with the HTTP transport and install it as a global logger.
The install + run snippets above are the standard OpenTelemetry starting points. Because all
SDKs honour the OTEL_* environment variables, the same endpoint configuration works for
every language.