From c295345ca5a643490072b67666a2d661a7cfb9d7 Mon Sep 17 00:00:00 2001 From: Maxime Leblanc Date: Fri, 18 Oct 2024 10:48:44 +0200 Subject: [PATCH] [EXPORTERS]: elastic search put attributes in json root instead of under `attributes` This allows user to set other fields that are part of the [ECS log documentation](https://www.elastic.co/guide/en/ecs/8.11/ecs-log.html). For instance, it allows to have an attribute with key `log.file`, that will, thanks to `nlohmann::json`, appear as : ``` { "log": { "file": "xxx" } } ``` Closes #3091 --- exporters/elasticsearch/src/es_log_recordable.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exporters/elasticsearch/src/es_log_recordable.cc b/exporters/elasticsearch/src/es_log_recordable.cc index 92cccc4921..d690e1e15c 100644 --- a/exporters/elasticsearch/src/es_log_recordable.cc +++ b/exporters/elasticsearch/src/es_log_recordable.cc @@ -312,7 +312,7 @@ void ElasticSearchRecordable::SetAttribute( nostd::string_view key, const opentelemetry::common::AttributeValue &value) noexcept { - WriteKeyValue(key, value, "attributes"); + WriteValue(value, key.data()); } void ElasticSearchRecordable::SetResource(