Logs
Send OpenTelemetry logs to KubeSense over OTLP/HTTP or OTLP/gRPC from VMs, ECS, Lambda and external services, with the resource attributes KubeSense needs.
KubeSense receives OpenTelemetry logs at the Log Aggregator over OTLP/HTTP or OTLP/gRPC. Logs arrive in the Log Explorer and go through the same log pipelines as every other log source.
When to use OTLP logs
| Where the logs come from | Use |
|---|---|
| Pods on Kubernetes | The KubeSense log sensor. It already collects container stdout and stderr, so don't also export these logs over OTLP or each line is stored twice |
| VMs and EC2 hosts | OTLP, from an OpenTelemetry Collector on the host. See OpenTelemetry (OTLP) |
| Amazon ECS | See ECS |
| AWS Lambda | See AWS Lambda Logs |
| SaaS platforms and third-party services | OTLP, pushed to the Aggregator's load balancer. See External Service Logs & Metrics |
On Kubernetes, set OTEL_LOGS_EXPORTER=none in applications so the SDKs don't export logs that the log sensor already collects.
Endpoints
| Protocol | Endpoint |
|---|---|
| OTLP/HTTP | http://<AGGREGATOR_HOST>:30055/v1/logs |
| OTLP/gRPC | <AGGREGATOR_HOST>:30056 |
Turn the receiver on in your KubeSense server values. It's off by default:
aggregator:
sources:
otel:
enabled: trueFrom outside the KubeSense cluster, expose the Aggregator through an internal load balancer. See External Service Logs & Metrics. The load balancer keeps the 30055 and 30056 port numbers.
Resource attributes
KubeSense uses these resource attributes to place each log record:
| Attribute | Becomes | Required |
|---|---|---|
service.name | workload, instance and container_name in the Log Explorer | Yes |
kubesense.cluster | cluster | Yes |
kubesense.env_type | env_type: legacy for VMs and EC2 hosts, ecs, docker, or any other value (for example external) for third-party sources | Yes |
service.namespace | namespace | Recommended |
Severity comes from the OTLP severity_text field. When it is empty, KubeSense detects the level from the message body.
Send from an application
For an application on a VM that logs through the OpenTelemetry SDK:
OTEL_SERVICE_NAME=billing-worker
OTEL_RESOURCE_ATTRIBUTES=kubesense.cluster=prod-vms,kubesense.env_type=legacy
OTEL_LOGS_EXPORTER=otlp
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=http/protobuf
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=http://<AGGREGATOR_HOST>:30055/v1/logsTo use gRPC instead, set OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=grpc and OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=http://<AGGREGATOR_HOST>:30056.
Send through a Collector
processors:
resource/kubesense:
attributes:
- { key: kubesense.cluster, value: prod-vms, action: upsert }
- { key: kubesense.env_type, value: legacy, action: upsert }
exporters:
otlphttp/kubesense_logs:
logs_endpoint: http://<AGGREGATOR_HOST>:30055/v1/logs
tls:
insecure: true
service:
pipelines:
logs:
receivers: [otlp]
processors: [resource/kubesense, batch]
exporters: [otlphttp/kubesense_logs]To read log files on a host, add the filelog receiver to the same pipeline. See OpenTelemetry (OTLP) for a complete host configuration.
Troubleshooting
| Symptom | Likely cause |
|---|---|
Connection refused on 30055 or 30056 | aggregator.sources.otel.enabled is off, or the port isn't reachable from the sender |
| Every log line appears twice | The application exports OTLP logs on Kubernetes, where the log sensor also collects them. Set OTEL_LOGS_EXPORTER=none |
| Logs have no workload or land under the wrong cluster | service.name, kubesense.cluster or kubesense.env_type is missing |
| Every log shows the same level | severity_text is empty and the message has no recognizable level. Set the severity in your logging bridge |