Skip to Content
KubeSense

OpenTelemetry (OTLP)

Send OpenTelemetry traces and logs to KubeSense from Kubernetes, VMs and EC2 hosts, ECS, and other platforms.

Ingesting OTEL Traces & Logs with KubeSense

KubeSense ingests OpenTelemetry (OTLP) traces and logs and shows them natively in APM and the log explorer. The endpoints are the same wherever your application runs. What changes by platform is how you run the collector and which resource attributes you set.

Choose your platform

Where your application runsTracesLogsHost and container metrics
Kubernetes (the KubeSense cluster or another cluster)From Kubernetes on this page, or the OpenTelemetry OperatorCollected by the KubeSense log sensor. No OTLP neededCollected by the KubeSense sensor
VM or EC2 host (Linux or Windows)From a VM or EC2 host on this pageFrom a VM or EC2 host on this pageHost Monitoring
Amazon ECS on FargateTraces & MetricsLogsTraces & Metrics
Amazon ECS on EC2Traces & MetricsLogsTraces & Metrics
AWS Lambda—AWS Lambda Logs—
Docker host (no Kubernetes)Sensor from Docker StandaloneSensor from Docker StandaloneSensor from Docker Standalone
Third-party services and vendors—External Service Logs & MetricsExternal Service Logs & Metrics

To instrument the application itself (Java, Node.js, Python, Go, .NET, Ruby, Next.js), see Instrumentation. The language pages cover both Kubernetes and VMs.

Endpoints

SignalReceiverEndpointEnable with
Traceskubesense-kubecolhttp://{KUBECOL_HOST}:33443 (OTLP/HTTP only)kubecol.external_agent_traces.enabled: true. See Instrumentation
Logskubesense-aggregatorhttp://{AGGREGATOR_HOST}:30055/v1/logs (OTLP/HTTP) or {AGGREGATOR_HOST}:30056 (OTLP/gRPC)aggregator.sources.otel.enabled: true. See External Service Logs & Metrics

Both listeners are off by default. Inside the KubeSense cluster, {KUBECOL_HOST} and {AGGREGATOR_HOST} are the service names, for example kubesense-kubecol.kubesense.svc.cluster.local. From anywhere else, they are the internal load balancer that exposes each port to your network.

Port 33443 accepts OTLP over HTTP only: Use the collector's otlphttp exporter, or http/protobuf in an SDK. gRPC sent to 33443 fails. Give the base address without a path: the exporter adds /v1/traces itself.

Resource attributes

Set these on every service, in the application (OTEL_RESOURCE_ATTRIBUTES) or in a collector resource processor:

AttributeValuePurpose
service.nameYour service nameService name in APM; workload in the log explorer. Required for logs
kubesense.clusterCluster or domain name, as shown in KubeSenseGroups the data under the right cluster or domain
kubesense.env_typeOne of k8s, legacy (VMs and EC2 hosts), docker, ecs or lambdaTells KubeSense how to correlate the data with infrastructure

Ingestion from Kubernetes Pods

Point the application's exporters at KubeSense. KubeSense enriches the spans with Kubernetes metadata.

env:
  - name: OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
    value: "http://{KUBECOL_HOST}:33443/v1/traces"
  - name: OTEL_EXPORTER_OTLP_PROTOCOL
    value: "http/protobuf"
  - name: OTEL_LOGS_EXPORTER
    value: "none"
  - name: OTEL_RESOURCE_ATTRIBUTES
    value: "kubesense.env_type=k8s,kubesense.cluster={CLUSTER_NAME}"

Don't send pod logs over OTLP: The KubeSense log sensor already collects pod logs from stdout. Exporting them over OTLP as well produces duplicates, so keep OTEL_LOGS_EXPORTER=none in Kubernetes.

Automatic Attribute Enrichment

KubeSense automatically enriches the traces with Kubernetes metadata (pod, workload, namespace, node) to give them more context.

Forwarding Traces from an OpenTelemetry Collector Inside Kubernetes

If your services already send to your own OpenTelemetry Collector, add a KubeSense exporter and a resource processor to it:

processors:
  resource/kubesense:
    attributes:
      - key: kubesense.cluster
        value: {CLUSTER_NAME}
        action: insert
      - key: kubesense.env_type
        value: k8s
        action: insert

exporters:
  otlphttp/kubesense_traces:
    endpoint: http://{KUBECOL_HOST}:33443

service:
  pipelines:
    traces:
      processors: [resource/kubesense]
      exporters: [otlphttp/kubesense_traces]

Forwarding from an OpenTelemetry Collector on a VM or EC2 host

On a Linux or Windows VM, including an EC2 instance, run one OpenTelemetry Collector per host. Your applications send traces (and optionally logs) to it on localhost, and it also tails log files. The collector adds the host's identity and forwards everything to KubeSense.

Applications on the host ── OTLP (localhost:4317/4318) ──┐
Log files on disk ───────── filelog ─────────────────────┤
                                                          ▼
                                          OpenTelemetry Collector
                                           ├─ traces  ─▶ {KUBECOL_HOST}:33443
                                           ├─ logs    ─▶ {AGGREGATOR_HOST}:30055
                                           └─ metrics ─▶ see Host Monitoring

Step 1: Prepare KubeSense

  1. Turn on both listeners (kubecol.external_agent_traces.enabled and aggregator.sources.otel.enabled). See Endpoints.
  2. Expose ports 33443 and 30055 through an internal load balancer, and allow inbound traffic from the hosts' subnets. On AWS, the aggregator settings in External Service Logs & Metrics are an example.
  3. Create a domain: in Settings → Domain, create a domain of type Legacy. Use its name as kubesense.cluster below.

Step 2: Install the collector

Install otelcol-contrib 0.120.0 or later as a service, as described in Host Monitoring → Install the OpenTelemetry Collector.

Step 3: Configure the collector

Replace the collector's config file (/etc/otelcol-contrib/config.yaml on Linux, C:\Program Files\OpenTelemetry Collector\config.yaml on Windows), then set:

  • {KUBECOL_HOST} and {AGGREGATOR_HOST}: the load balancer addresses from Step 1
  • {DOMAIN}: the domain name from Step 1
  • One filelog/<app> receiver per application whose log files you want to collect, with its service.name
receivers:
  # Your applications send traces (and optionally logs) here.
  otlp:
    protocols:
      grpc:
        endpoint: localhost:4317
      http:
        endpoint: localhost:4318

  # One filelog receiver per application. service.name becomes the
  # workload in the log explorer, so give each application its own.
  filelog/checkout:
    include: [/var/log/checkout/*.log]   # Windows: ['C:\apps\checkout\logs\*.log']
    start_at: end
    resource:
      service.name: checkout

processors:
  memory_limiter:
    check_interval: 1s
    limit_mib: 400
    spike_limit_mib: 100

  # Places the data in your KubeSense domain.
  resource/kubesense:
    attributes:
      - key: kubesense.cluster
        value: "{DOMAIN}"
        action: upsert
      - key: kubesense.env_type
        value: legacy
        action: upsert

  # Adds host.name and the cloud details (EC2 instance ID, region, ...).
  # Keep the detector for your cloud (ec2, azure or gcp) and drop the others.
  resourcedetection:
    detectors: [env, ec2, azure, gcp, system]
    timeout: 5s
    override: false
    system:
      hostname_sources: [os]

  batch:
    timeout: 10s

exporters:
  otlphttp/kubesense_traces:
    endpoint: http://{KUBECOL_HOST}:33443
  otlphttp/kubesense_logs:
    logs_endpoint: http://{AGGREGATOR_HOST}:30055/v1/logs

service:
  pipelines:
    traces:
      receivers: [otlp]
      processors: [memory_limiter, resource/kubesense, resourcedetection, batch]
      exporters: [otlphttp/kubesense_traces]
    logs:
      receivers: [otlp, filelog/checkout]
      processors: [memory_limiter, resource/kubesense, resourcedetection, batch]
      exporters: [otlphttp/kubesense_logs]

To collect host metrics as well, add the hostmetrics receiver, its prometheusremotewrite exporter and a metrics pipeline from Host Monitoring to the same file. The processors above are the same ones that page uses.

Validate the file, then restart the service:

sudo otelcol-contrib validate --config /etc/otelcol-contrib/config.yaml
sudo systemctl restart otelcol-contrib

On Windows, restart the otelcol-contrib service from Services or with Restart-Service otelcol-contrib.

Let host.name identify the host: Don't set kubesense.node_name on a VM. KubeSense takes a span's host from kubesense.node_name when it is set, and from host.name otherwise. Leaving host.name to the resourcedetection processor keeps the traces on the same host name as the host's metrics.

Collect each log file once: If the host also runs the KubeSense sensor from VM deployments with LOG_PATHS, don't add the same files to a filelog receiver. Each file would be ingested twice. Likewise, an application should either write log files that the collector tails or export logs over OTLP, not both.

Step 4: Point your applications at the collector

Instrument each application as described on its language page, and send to the local collector:

OTEL_SERVICE_NAME=checkout
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
OTEL_LOGS_EXPORTER=none   # set to otlp to export logs instead of tailing files

The collector adds kubesense.cluster and kubesense.env_type, so the application doesn't need OTEL_RESOURCE_ATTRIBUTES.

You can also skip the collector and send from the application straight to KubeSense: point OTEL_EXPORTER_OTLP_TRACES_ENDPOINT at http://{KUBECOL_HOST}:33443/v1/traces and set OTEL_RESOURCE_ATTRIBUTES=kubesense.cluster={DOMAIN},kubesense.env_type=legacy. A collector is still recommended, for batching and retries and for the host and cloud attributes it adds.

Step 5: Verify

  • Traces: open APM → Services, select your domain, and look for each service.name within a minute or two of traffic.
  • Logs: open the log explorer, select your domain, and filter on workload = the service.name.
  • Nothing arrives: check the collector's own logs (journalctl -u otelcol-contrib on Linux) for export errors. A connection refused on 33443 or 30055 means the listener isn't enabled or the port isn't reachable from the host.

On this page