Collaborators: Alolita Sharma (OTEL GC, AWS), Cyrille Le Clerc (Elastic), Daniel Khan (Elastic), Christian Beedgen (Sumo), Jonah Kowall (Logz.io), Tigran N. (Splunk)
This proposal is to add support for the Elastic Common Schema (ECS) in the OpenTelemetry specification and provide full interoperability for ECS in OpenTelemetry component implementations. We propose to implement this support enriching OpenTelemetry Semantic Conventions with ECS fields. The goal is to merge ECS into Otel Semantic Conventions.
We propose 3 steps to add support for ECS in OpenTelemetry Semantic Conventions:
- Validation of the principle of adding support for ECS in OpenTelemetry and validation that this support would be implemented merging ECS fields in OpenTelemetry Semantic Conventions,
- Validation of the methodology to merge these ECS fields. As there are 40+ ECS namespaces and as there will be few overlaps and maybe needs to evolve some ECS field names to match the vocabulary and conventions of Otel, we have in mind an iterative process tackling namespaces one after the other. We are also interested in clarifying how downstream schemas could be created; We have for example identified the value of having downstream schemas to specify persistence characteristics (see ECS string persistence types match_only_text, keyword constant_keyword, wildcard),
- Actual merge of ECS fields in Otel Semantic Conventions.
Note that we didn't propose in this OTEP the mapping of all ECS fields because this is a substantial effort, we prefered to first validate the principle and, once consensus is reached, actually define the mapping.
Adding the Elastic Common Schema (ECS) to OpenTelemetry (OTEL) is a great way to accelerate the integration of vendor-created logging and OTEL component logs (ie OTEL Collector Logs Receivers). The goal is to define vendor neutral semantic conventions for most popular types of systems and support vendor created or open-source components (for example HTTP access logs, network logs, system access/authentication logs) extending OTEL correlation to these new signals.
Adding the coverage of ECS to OTEL would provide guidance to authors of OpenTelemetry Collector Logs Receivers and help establish the OTEL Collector as a de facto standard log collector with a well-defined schema to allow for richer data definition.
In addition to the use case of structured logs, the maturity of ECS for SIEM (Security Information and Event Management) is a great opportunity for OpenTelemetry to expand its scope to the security use cases.
Another significant use case is providing first-class support for Kubernetes application logs, system logs as well as application introspection events. We would also like to see support for structured events (e.g. k8seventsreceiver) and using ‘content-type' to identify event types.
We'd like to see different categories of structured logs being well-supported in the OTEL Log Data Model, presumably through semantic conventions for log attributes. For example, NGINX access logs and Apache access logs should be processed the same way as structured logs. This would help in trace and metric correlation with such log data as well as it would help grow the ecosystem of curated UIs provided by observability backends and monitoring dashboards (e.g. one single HTTP Access log dashboard benefiting Apache HTTPD, Nginx, and HAProxy).
Adoption of OTEL logs will accelerate greatly if ECS is leveraged as the common standard, using this basis for normalization. OTEL Logs adoption will be accelerated by this support. For example, ECS can provide the unified structured format for handling vendor generated along with open source logs.
Customers will benefit from turnkey logs integrations that will be fully recognized by OTEL compatible observability products and services.
OpenTelemetry logging is today mostly structured when instrumentation libraries are used. However, most of the logs which exist today are generated by software, hardware, and cloud services which the user cannot control. OpenTelemetry provides a limited set of "reference integrations" to structure logs: primarily the OpenTelemetry Collector Kubernetes Events Receiver and an example of a regexp based parsing of Tomcat access logs with OpenTelemetry Collector File Receiver (here).
The semantic conventions of a log are a challenge. What is a specific component defined in a log and how does it relate to other logs which have the same semantic component defined differently. ECS has already done some heavy-lifting on defining a unified set of semantic conventions which can be adopted in OTEL.
OpenTelemetry has the potential to grow exponentially if the data from these other services can be correlated with instrumented code and components. In order to do this, industry stakeholders should leverage a common and standard logging data model which allows for the mapping of these different data types. The OpenTelemetry data protocol can provide this interoperable open standard. This unlocks countless use cases, and ensures that OpenTelemetry can work with other technologies which are not OpenTelemetry compliant.
The Elastic Common Schema (ECS) is an open source specification, developed with support from Elastic's user community. ECS defines a common set of fields to be used when storing data in Elasticsearch, such as logs, metrics, and security and audit events. The goal of ECS is to enable and encourage users of Elasticsearch to normalize their event data, so that they can better analyze, visualize, and correlate the data represented in their events. Learn more at: https://www.elastic.co/guide/en/ecs/current/ecs-reference.html
The coverage of ECS is very broad including in depth support for logs, security, and network events such as "logs.* fields" , "geo.* fields", "tls.* fields", "dns.* fields", or "vulnerability.* fields".
ECS has the following guiding principles:
- ECS favors human readability in order to enable broader adoption,
- ECS events include metadata to enable correlations across any dimension (host, data center, docker image, ip address...),
- ECS doesn't differentiate the metadata fields that are specific to each event of the event source and the metadata that are shared by all the events of the source the same way OTEL differentiates Resource Attributes and Log/Span Attributes),
- ECS groups fields in namespaces in order to:
- Offer consistency and readability,
- Enable reusability of namespaces in different contexts,
- For example, the "geo" namespace is nested in the "client.geo", "destination.geo", "host.geo" or "threat.indicator.geo" namespaces
- Enable extensibility adding fields to namespaces and adding new namespaces,
- Prevent field name conflicts
- ECS covers a broad spectrum of events with 40+ namespaces including detailed coverage of security and network events. It's much broader than simple logging use cases.
Example of a Nginx Access Log entry structured with ECS
{
"@timestamp":"2020-03-25T09:51:23.000Z",
"client":{
"ip":"10.42.42.42"
},
"http":{
"request":{
"referrer":"-",
"method":"GET"
},
"response":{
"status_code":200,
"body":{
"bytes":2571
}
},
"version":"1.1"
},
"url":{
"path":"/blog"
},
"user_agent":{
"original":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
"os":{
"name":"Mac OS X",
"version":"10.14.0",
"full":"Mac OS X 10.14.0"
},
"name":"Chrome",
"device":{
"name":"Other"
},
"version":"70.0.3538.102"
},
"log":{
"file":{
"path":"/var/log/nginx/access.log"
},
"offset":33800
},
"host": {
"hostname": "cyrille-laptop.home",
"os": {
"build": "19D76",
"kernel": "19.3.0",
"name": "Mac OS X",
"family": "darwin",
"version": "10.15.3",
"platform": "darwin"
},
"name": "cyrille-laptop.home",
"id": "04A12D9F-C409-5352-B238-99EA58CAC285",
"architecture": "x86_64"
}
}
Description | OTel Logs and Event Record | Elastic Common Schema (ECS) |
---|---|---|
Metadata shared by all the Log Messages / Spans of an application instance | Resource Attributes | ECS fields |
Metadata specific to each Log Message / Span | Attributes | ECS Fields |
Message of log events | Body | message field |
Naming convention | Dotted names | Dotted names |
Reusability of namespaces | Namespaces are intended to be composed | Namespaces are intended to be composed |
Extensibility | Attributes can be extended by either adding a user defined field to an existing namespaces or introducing new namespaces. | Extra attributes can be added in each namespace and users can create their own namespaces |
Category | OTel Logs and Event Record (all or a subset of GRPC data types) | ECS Data Types |
---|---|---|
Text | string | text, match_only_text, keyword constant_keyword, wildcard |
Dates | uint64 nanoseconds since Unix epoch | date, date_nanos |
Numbers | number | long, double, scaled_float, boolean… |
Objects | uint32, uint64… | object (JSON object), flattened (An entire JSON object as a single field value) |
Structured Objects | No complex semantic data type specified for the moment (e.g. string is being used for ip addresses rather than having an "ip" data structure in Otel). Note that Otel supports arrays and nested objects. |
ip, geo_point, geo_shape, version, long_range, date_range, ip_range |
Binary data | Byte sequence | binary |
Some differences exist on fields that are both defined in OpenTelemetry Semantic Conventions and in ECS. In this case, it would make sense for overlapping ECS fields to not be integrated in the new specification.
OTel Logs and Event Record | Elastic Common Schema (ECS) | Description |
Timestamp (uint64 nanoseconds since Unix epoch) | @timestamp (date) | |
TraceId (byte sequence), SpanId (byte sequence) | trace.id (keyword), span.id (keyword) | |
N/A | Transaction.id (keyword) | |
SeverityText (string) | log.syslog.severity.name (keyword), log.level (keyword) | |
SeverityNumber (number) | log.syslog.severity.code | |
Body (any) | message (match_only_text) | |
process.cpu.load (not specified but collected by Otel Collector)
process.cpu.time (async counter) |
host.cpu.usage (scaled_float) with a slightly different measurement than what otel metrics measure | Note that most metrics have slightly different names and semantics between ECS and OpenTelemetry |
How would OpenTelemetry users practically use the new OpenTelemetry Semantic Conventions Attributes brought by ECS
The author of the "Otel Collector Access logs file receiver for web server XXX" would find in the Otel Semantic Convention specifications all the guidance to map the fields of the web server logs, not only the attributes that the Otel Semantic Conventions has specified today for HTTP calls, but also attributes for the User Agent or the Geo Data. This completeness of the mapping will help the author of the integration to produce OTel Log Message that will be compatible with access logs other web components (web servers, load balancers, L7 firewalls...) allowing turnkey integration with observability solutions and enabling richer correlations.
Prometheus is a de facto standard for observability metrics and OpenTelemetry already provides full interoperability with the Prometheus ecosystem.
It would be useful to get interoperability between metrics collected by official Prometheus exporters (e.g. the Node/system metrics exporter or the MySQL server exporter) and their equivalent OpenTelemetry Collector receivers (e.g. Otel Collector Host Metrics Receiver or MySQL Receiver).
Note that one of the challenges with Prometheus metrics naming conventions is that these are implicit conventions defined by each integration author which doesn't enable correlation due to the lack of consistency across integrations. For example, this inconsistency increases the complexity that an end-user has to deal with when configuring and monitoring alerts.
Prometheus' conventions are restricted to the style of the name of the metrics (see Metric and label naming | Prometheus ) but don't specify unified metric names.
Some areas that need to be addressed in the long run as ECS is integrated into OTEL include defining the innovation process, providing maintainer rights to Elastic contributors who maintain ECS today, ensuring the OTEL specification incorporates the changes to accommodate ECS, and a process for handling breaking changes if any (the proposal Define semantic conventions and instrumentation stability #2180 should tackle this point). Also, migration of existing naming (e.g. Prometheus exporter) to standardized convention (see Semantic Conventions for System Metrics , Semantic Conventions for OS Process Metrics).