$ docker run --name otel -p4318:4318 -d otel/opentelemetry-collector
8f6404ac38bcce6f2624312de4129f61535f5cc5ecc981cd776bd452fc7f2976
$ curl localhost:4318/v1/logs -H "Content-Type: application/json" -d '{}'
{"partialSuccess":{}}
$ curl localhost:4318/v1/metrics -H "Content-Type: application/json" -d '{}'
{"partialSuccess":{}}
$ cat otel-config.yaml
receivers:
otlp:
protocols:
http:
endpoint: 0.0.0.0:4318
exporters:
debug: {}
service:
pipelines:
logs:
receivers: [otlp]
exporters: [debug]
metrics:
receivers: [otlp]
exporters: [debug]
$ docker run -d --name otel -p 4318:4318 -v $(pwd)/otel-config.yaml:/etc/otel-config.yaml otel/opentelemetry-collector:latest --config=/etc/otel-config.yaml
77be5d518cdb079d28d6c6b84e2ab03515d12653ed7786d6b0e660718c26a9fd
$ curl -X POST http://localhost:4318/v1/logs -H "Content-Type: application/json" -d '{
"resourceLogs": [{
"scopeLogs": [{
"logRecords": [{
"body": {"stringValue": "Sample log message"}
}]
}]
}]
}'
{"partialSuccess":{}}
$ curl -X POST http://localhost:4318/v1/metrics -H "Content-Type: application/json" -d '{
"resourceMetrics": [
{
"scopeMetrics": [
{
"metrics": [
{
"name": "test_metric",
"gauge": {
"dataPoints": [
{
"value": 123
}
]
}
}
]
}
]
}
]
}'
{"partialSuccess":{}}
$ docker logs otel
...
2025-08-28T05:15:21.458Z info Logs {"resource": {"service.instance.id": "0c9a20ec-5653-43d4-98fe-ac788eebe35f", "service.name": "otelcol", "service.version": "0.133.0"}, "otelcol.component.id": "debug", "otelcol.component.kind": "exporter", "otelcol.signal": "logs", "resource logs": 1, "log records": 1}
2025-08-28T05:15:23.944Z info Metrics {"resource": {"service.instance.id": "0c9a20ec-5653-43d4-98fe-ac788eebe35f", "service.name": "otelcol", "service.version": "0.133.0"}, "otelcol.component.id": "debug", "otelcol.component.kind": "exporter", "otelcol.signal": "metrics", "resource metrics": 1, "metrics": 1, "data points": 1}