Appearance
Send APM data through the agent
With this route, applications send OpenTelemetry data to the Logcore agent on the same server. The agent forwards it to Logcore with its own API key, so your apps need no key.
app ──OTLP──▶ localhost:4317 / :4318 (logcore-agent) ──HTTPS + gzip──▶ Logcore1. Enable APM in the agent
The installer writes the APM block into logcore.yaml commented out. Remove the # from those lines:
yaml
# apm:
# enabled: true
# otlp_grpc_addr: "127.0.0.1:4317" # OTLP/gRPC from local apps ("off" disables)
# otlp_http_addr: "127.0.0.1:4318" # OTLP/HTTP; "0.0.0.0:4318" to accept apps in containersyaml
apm:
enabled: true
otlp_grpc_addr: "127.0.0.1:4317" # OTLP/gRPC from local apps ("off" disables)
otlp_http_addr: "127.0.0.1:4318" # OTLP/HTTP; "0.0.0.0:4318" to accept apps in containersUncommenting only apm: and enabled: true is enough; the addresses shown are the defaults.
Then restart the agent and check it:
sh
sudo systemctl restart logcore-agent
sudo logcore-agent status # look for the "APM (OpenTelemetry)" sectionpowershell
logcore-agent service restart
logcore-agent statusDo it at install time
Add LOGCORE_APM=true to the install command to install with APM already enabled. Running the installer again with LOGCORE_APM=true also enables it on an existing installation.
2. Point your app at the agent
sh
OTEL_SERVICE_NAME=checkout
OTEL_RESOURCE_ATTRIBUTES=deployment.environment=production
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
OTEL_TRACES_EXPORTER=otlp
OTEL_METRICS_EXPORTER=otlp
OTEL_LOGS_EXPORTER=otlpFor gRPC, use OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317 and OTEL_EXPORTER_OTLP_PROTOCOL=grpc.
Don't set OTEL_EXPORTER_OTLP_HEADERS. The agent adds the key itself.
Next, add OpenTelemetry to your app: Language setup.
What the agent adds
If your app doesn't set them, the agent adds these resource attributes:
| Attribute | Value |
|---|---|
host.name | the agent's hostname |
deployment.environment | the value of the agent's env: tag, for example env:prod gives prod |
So traces line up with the host in Infrastructure and its environment without any extra configuration.
Apps in Docker on the same host
By default the agent listens on 127.0.0.1 only. To accept data from containers:
yaml
apm:
enabled: true
otlp_http_addr: "0.0.0.0:4318"Then in the container use the host's address:
yaml
# docker-compose.yml
services:
api:
environment:
OTEL_EXPORTER_OTLP_ENDPOINT: http://host.docker.internal:4318
extra_hosts:
- "host.docker.internal:host-gateway"WARNING
0.0.0.0 listens on every interface. Block port 4318 from outside the host with your firewall, because anyone who can reach it can send data to your organization.
Ports already in use
If another program, such as an OpenTelemetry Collector, already uses 4317 or 4318, choose other ports, or turn one protocol off:
yaml
apm:
enabled: true
otlp_grpc_addr: "off"
otlp_http_addr: "127.0.0.1:14318"and point apps at http://localhost:14318.
When Logcore is unreachable
The agent passes the failure back to the app as a retryable error (HTTP 503 or gRPC UNAVAILABLE). OpenTelemetry SDKs then retry with backoff, so short outages don't lose data.