RousselTMLEARNING

Article · Elasticsearch: from discovery to expertise

Ingesting OpenTelemetry logs

1. The OTel log model #

Body, severity, attributes, context.

Fields #

OTel fieldStored in Elasticsearch (otel mode)
Bodybody.text (body.structured)
SeverityText / SeverityNumberseverity_text / severity_number
Attributesattributes.*
Resourceresource.attributes.* (service.name, host.name, k8s.pod.name)
TraceId / SpanIdtrace_id / span_id: direct link to the trace
Receiver, parsing, enrichment, Elasticsearch.

2. Collecting files #

The filelog receiver.

Configuration #

receivers:
  filelog:
    include: [/var/log/monapp/*.log]
    start_at: end
    operators:
      - type: regex_parser
        regex: '^(?P<ts>\S+) (?P<level>[A-Z]+) (?P<msg>.*)$'
        timestamp: { parse_from: attributes.ts, layout_type: gotime, layout: '2006-01-02T15:04:05Z07:00' }
        severity: { parse_from: attributes.level }
      - type: move
        from: attributes.msg
        to: body
processors:
  resource:
    attributes:
      - { key: service.name, value: monapp, action: upsert }
service:
  pipelines:
    logs: { receivers: [filelog], processors: [resource, batch], exporters: [elasticsearch] }
Good practice: Always set service.name: it is the key linking a service's logs, traces and metrics in Kibana.

Kubernetes #

On Kubernetes, the Collector as a DaemonSet reads /var/log/pods; the k8sattributes processor adds namespace, pod, deployment and labels, essential for filtering.

3. Querying and controlling volume #

ES|QL and filtering.

Queries #

FROM logs-*.otel-*
| WHERE severity_text == "ERROR" AND @timestamp > NOW() - 1 hour
| STATS erreurs = COUNT(*) BY resource.attributes.service.name
| SORT erreurs DESC

Filtering at the source #

processors:
  filter/debug:
    error_mode: ignore
    logs:
      log_record:
        - severity_number < SEVERITY_NUMBER_INFO
Common mistake: Shipping debug logs from all of production: volume, hence storage cost, explodes. Filter in the Collector or lower the level in the application.

📄 Ingesting OpenTelemetry logs into Elasticsearch →

My progress

  • ⏱ Estimated time : ≈ 6 min

Sign in to track your progress and take notes. Sign in

⭐ Rate this lesson

5.0 initial rating from the teaching team

Sign in to rate this lesson →

💬 Recent discussions about this course

Ask a question about this lesson →See all discussions about this course

Course Glossary

RBAC (Role-Based Access Control)

An access control method where permissions are assigned to specific roles (e.g., admin, reader) rather than directly to individual users.

Authentication

The process of verifying the identity of a user or system (e.g., login/password, tokens, biometrics).

Authorization

The process that occurs after authentication to determine if the entity has the necessary rights and privileges to access a resource.

API Key

A unique alphanumeric code used to identify, authenticate, and authorize access to an Application Programming Interface (API).

Architecture

The overall structural design of an IT system, defining its various components, their relationships, and the principles guiding its evolution.

Repository

A centralized storage location. This can refer to a source code repository (e.g., Git) or an artifact and binary repository (e.g., Harbor, Nexus, Arti...

Elasticsearch

A distributed, RESTful search and analytics engine capable of addressing a growing number of use cases, built on Apache Lucene.

Recommended Articles

OpenTelemetry traces in Elasticsearch and Kibana APM

Instrument applications with OpenTelemetry or EDOT SDKs, send traces to Elasticsearch, get Kibana...

OpenTelemetry and Elasticsearch: compatibility and architecture

Send OpenTelemetry to Elasticsearch: Collector and elasticsearch exporter, managed OTLP endpoint,...

OpenTelemetry metrics in Elasticsearch

Collect host, Kubernetes and application metrics with OpenTelemetry, understand temporality and t...

Standalone Elastic Agent, Logstash and Kafka outputs, and OpenTelemetry (EDOT)

Write a standalone configuration, ship to Logstash or Kafka, and use Elastic Agent as an OpenTele...

Elastic Observability: logs, infrastructure, APM and synthetics

Elastic Observability features: log exploration, infrastructure inventory with Elastic Agent and ...

Sending telemetry to ClickStack: OpenTelemetry SDKs, collectors, logs, Kubernetes and browser sessions

Feeding ClickStack: ingestion key, OpenTelemetry SDK variables, forwarding through an existing co...

OpenTelemetry and Dynatrace: OTLP, collector and instrumentation

Integrate OpenTelemetry with Dynatrace: OTLP endpoint and tokens, Dynatrace OTel Collector, trace...

Logs with OpenTelemetry: data model, appenders, correlation and collection

Master the log signal: the LogRecord data model, the Logs Bridge API and appenders (Logback, Log4...

Elasticsearch monitoring and troubleshooting: health, unassigned shards, JVM, hot threads and slow logs

Diagnose an Elasticsearch cluster: cluster health and CAT APIs, unassigned shards and allocation ...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!