Skip to content

Commit e75fca3

Browse files
author
elasticsearchmachine
committed
Merge remote-tracking branch 'origin/main' into lucene_snapshot
2 parents e0ef305 + 6932440 commit e75fca3

File tree

43 files changed

+829
-123
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+829
-123
lines changed

docs/changelog/131027.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 131027
2+
summary: Handle structured log messages
3+
area: Ingest Node
4+
type: feature
5+
issues:
6+
- 130333

docs/changelog/131990.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 131990
2+
summary: Prevent the trained model deployment memory estimation from double-counting
3+
allocations
4+
area: Machine Learning
5+
type: bug
6+
issues: []

docs/reference/enrich-processor/normalize-for-stream.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,87 @@ will be normalized into the following form:
153153
"trace_id": "abcdef1234567890abcdef1234567890"
154154
}
155155
```
156+
## Structured `message` field
157+
158+
If the `message` field in the ingested document is structured as a JSON, the
159+
processor will determine whether it is in ECS format or not, based on the
160+
existence or absence of the `@timestamp` field. If the `@timestamp` field is
161+
present, the `message` field will be considered to be in ECS format, and its
162+
contents will be merged into the root of the document and then normalized as
163+
described above. The `@timestamp` from the `message` field will override the
164+
root `@timestamp` field in the resulting document.
165+
If the `@timestamp` field is absent, the `message` field will be moved to
166+
the `body.structured` field as is, without any further normalization.
167+
168+
For example, if the `message` field is an ECS-JSON, as follows:
169+
170+
```json
171+
{
172+
"@timestamp": "2023-10-01T12:00:00Z",
173+
"message": "{\"@timestamp\":\"2023-10-01T12:01:00Z\",\"log.level\":\"INFO\",\"service.name\":\"my-service\",\"message\":\"The actual log message\",\"http\":{\"method\":\"GET\",\"url\":{\"path\":\"/api/v1/resource\"}}}"
174+
175+
}
176+
```
177+
it will be normalized into the following form:
178+
179+
```json
180+
{
181+
"@timestamp": "2023-10-01T12:01:00Z",
182+
"severity_text": "INFO",
183+
"body": {
184+
"text": "The actual log message"
185+
},
186+
"resource": {
187+
"attributes": {
188+
"service.name": "my-service"
189+
}
190+
},
191+
"attributes": {
192+
"http.method": "GET",
193+
"http.url.path": "/api/v1/resource"
194+
}
195+
}
196+
```
197+
198+
However, if the `message` field is not recognized as ECS format, as follows:
199+
200+
```json
201+
{
202+
"@timestamp": "2023-10-01T12:00:00Z",
203+
"log": {
204+
"level": "INFO"
205+
},
206+
"service": {
207+
"name": "my-service"
208+
},
209+
"tags": ["user-action", "api-call"],
210+
"message": "{\"root_cause\":\"Network error\",\"http\":{\"method\":\"GET\",\"url\":{\"path\":\"/api/v1/resource\"}}}"
211+
}
212+
```
213+
it will be normalized into the following form:
214+
215+
```json
216+
{
217+
"@timestamp": "2023-10-01T12:00:00Z",
218+
"severity_text": "INFO",
219+
"resource": {
220+
"attributes": {
221+
"service.name": "my-service"
222+
}
223+
},
224+
"attributes": {
225+
"tags": ["user-action", "api-call"]
226+
},
227+
"body": {
228+
"structured": {
229+
"root_cause": "Network error",
230+
"http": {
231+
"method": "GET",
232+
"url": {
233+
"path": "/api/v1/resource"
234+
}
235+
}
236+
}
237+
}
238+
}
239+
```

docs/reference/query-languages/esql/_snippets/functions/layout/categorize.md

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/query-languages/esql/_snippets/functions/layout/sample.md

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/query-languages/esql/_snippets/functions/layout/scalb.md

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/query-languages/esql/_snippets/functions/parameters/categorize.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/IngestCommonPlugin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.elasticsearch.ingest.PipelineProcessor;
2222
import org.elasticsearch.ingest.Processor;
2323
import org.elasticsearch.plugins.ActionPlugin;
24+
import org.elasticsearch.plugins.ExtensiblePlugin;
2425
import org.elasticsearch.plugins.IngestPlugin;
2526
import org.elasticsearch.plugins.Plugin;
2627
import org.elasticsearch.rest.RestController;
@@ -33,7 +34,7 @@
3334

3435
import static java.util.Map.entry;
3536

36-
public class IngestCommonPlugin extends Plugin implements ActionPlugin, IngestPlugin {
37+
public class IngestCommonPlugin extends Plugin implements ActionPlugin, IngestPlugin, ExtensiblePlugin {
3738

3839
public IngestCommonPlugin() {}
3940

modules/ingest-otel/build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ apply plugin: 'elasticsearch.internal-yaml-rest-test'
1212
esplugin {
1313
description = 'Ingest processor that normalizes ECS documents to OpenTelemetry-compatible namespaces'
1414
classname ='org.elasticsearch.ingest.otel.NormalizeForStreamPlugin'
15+
extendedPlugins = ['ingest-common']
16+
}
17+
18+
dependencies {
19+
compileOnly(project(':modules:ingest-common'))
20+
compileOnly project(':modules:lang-painless:spi')
21+
clusterModules project(':modules:ingest-common')
22+
clusterModules project(':modules:lang-painless')
1523
}
1624

1725
restResources {

modules/ingest-otel/src/main/java/module-info.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@
1010
module org.elasticsearch.ingest.otel {
1111
requires org.elasticsearch.base;
1212
requires org.elasticsearch.server;
13+
requires org.apache.logging.log4j;
14+
requires org.elasticsearch.ingest.common;
1315
}

0 commit comments

Comments
 (0)