Skip to content

Commit fc2895f

Browse files
committed
Set host.name on ingested events. (#2531)
Use information from `system.name` when provided, otherwise derive data from `host.hostname`.` fixes #2502
1 parent ee24fea commit fc2895f

20 files changed

+104
-21
lines changed

_meta/fields.common.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,13 @@
396396
The hostname of the host the event was recorded on.
397397
overwrite: true
398398

399+
- name: name
400+
type: keyword
401+
description: >
402+
Name of the host the event was recorded on.
403+
It can contain same information as host.hostname or a name specified by the user.
404+
overwrite: true
405+
399406
- name: ip
400407
type: ip
401408
description: >

beater/test_approved_es_documents/TestPublishIntegrationErrors.approved.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@
182182
"architecture": "x64",
183183
"hostname": "node-name",
184184
"ip": "127.0.0.1",
185+
"name": "prod.example",
185186
"os": {
186187
"platform": "darwin"
187188
}
@@ -340,6 +341,7 @@
340341
"architecture": "x64",
341342
"hostname": "node-name",
342343
"ip": "127.0.0.1",
344+
"name": "prod.example",
343345
"os": {
344346
"platform": "darwin"
345347
}
@@ -433,6 +435,7 @@
433435
"architecture": "x64",
434436
"hostname": "node-name",
435437
"ip": "127.0.0.1",
438+
"name": "prod.example",
436439
"os": {
437440
"platform": "darwin"
438441
}
@@ -531,6 +534,7 @@
531534
"architecture": "x64",
532535
"hostname": "node-name",
533536
"ip": "127.0.0.1",
537+
"name": "prod.example",
534538
"os": {
535539
"platform": "darwin"
536540
}

beater/test_approved_es_documents/TestPublishIntegrationEvents.approved.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
},
2929
"host": {
3030
"hostname": "node-name",
31-
"ip": "127.0.0.1"
31+
"ip": "127.0.0.1",
32+
"name": "node-name"
3233
},
3334
"kubernetes": {
3435
"namespace": "namespace1",
@@ -143,7 +144,8 @@
143144
},
144145
"host": {
145146
"hostname": "node-name",
146-
"ip": "127.0.0.1"
147+
"ip": "127.0.0.1",
148+
"name": "node-name"
147149
},
148150
"kubernetes": {
149151
"namespace": "namespace1",
@@ -227,7 +229,8 @@
227229
},
228230
"host": {
229231
"hostname": "node-name",
230-
"ip": "127.0.0.1"
232+
"ip": "127.0.0.1",
233+
"name": "node-name"
231234
},
232235
"kubernetes": {
233236
"namespace": "namespace1",

beater/test_approved_es_documents/TestPublishIntegrationTransactions.approved.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"architecture": "x64",
2323
"hostname": "node-name",
2424
"ip": "127.0.0.1",
25+
"name": "node-name",
2526
"os": {
2627
"platform": "darwin"
2728
}
@@ -126,6 +127,7 @@
126127
"architecture": "x64",
127128
"hostname": "node-name",
128129
"ip": "127.0.0.1",
130+
"name": "node-name",
129131
"os": {
130132
"platform": "darwin"
131133
}
@@ -317,6 +319,7 @@
317319
"architecture": "x64",
318320
"hostname": "node-name",
319321
"ip": "127.0.0.1",
322+
"name": "node-name",
320323
"os": {
321324
"platform": "darwin"
322325
}

docs/data/elasticsearch/generated/errors.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@
173173
"architecture": "x64",
174174
"hostname": "node-name",
175175
"ip": "192.0.0.1",
176+
"name": "prod.example",
176177
"os": {
177178
"platform": "darwin"
178179
}
@@ -314,6 +315,7 @@
314315
"architecture": "x64",
315316
"hostname": "node-name",
316317
"ip": "192.0.0.1",
318+
"name": "prod.example",
317319
"os": {
318320
"platform": "darwin"
319321
}
@@ -390,6 +392,7 @@
390392
"architecture": "x64",
391393
"hostname": "node-name",
392394
"ip": "192.0.0.1",
395+
"name": "prod.example",
393396
"os": {
394397
"platform": "darwin"
395398
}
@@ -471,6 +474,7 @@
471474
"architecture": "x64",
472475
"hostname": "node-name",
473476
"ip": "192.0.0.1",
477+
"name": "prod.example",
474478
"os": {
475479
"platform": "darwin"
476480
}

docs/data/elasticsearch/generated/transactions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"architecture": "x64",
1414
"hostname": "node-name",
1515
"ip": "192.0.0.1",
16+
"name": "node-name",
1617
"os": {
1718
"platform": "darwin"
1819
}
@@ -100,6 +101,7 @@
100101
"architecture": "x64",
101102
"hostname": "node-name",
102103
"ip": "192.0.0.1",
104+
"name": "node-name",
103105
"os": {
104106
"platform": "darwin"
105107
}
@@ -274,6 +276,7 @@
274276
"architecture": "x64",
275277
"hostname": "node-name",
276278
"ip": "192.0.0.1",
279+
"name": "node-name",
277280
"os": {
278281
"platform": "darwin"
279282
}

docs/fields.asciidoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,16 @@ type: keyword
607607
The hostname of the host the event was recorded on.
608608
609609
610+
type: keyword
611+
612+
--
613+
614+
*`host.name`*::
615+
+
616+
--
617+
Name of the host the event was recorded on. It can contain same information as host.hostname or a name specified by the user.
618+
619+
610620
type: keyword
611621
612622
--

docs/spec/system.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@
99
"maxLength": 1024
1010
},
1111
"hostname": {
12-
"description": "Hostname of the system the agent is running on.",
12+
"description": "Hostname of the system the agent is running on. Will be ignored if kubernetes information is set.",
13+
"type": ["string", "null"],
14+
"maxLength": 1024
15+
},
16+
"name": {
17+
"description": "Name of the system the agent is running on. Will be set to hostname or derived from kubernetes information if not provided.",
1318
"type": ["string", "null"],
1419
"maxLength": 1024
1520
},

include/fields.go

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

model/metadata/generated/schema/metadata.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,12 @@ const ModelSchema = `{
160160
"maxLength": 1024
161161
},
162162
"hostname": {
163-
"description": "Hostname of the system the agent is running on.",
163+
"description": "Hostname of the system the agent is running on. Will be ignored if kubernetes information is set.",
164+
"type": ["string", "null"],
165+
"maxLength": 1024
166+
},
167+
"name": {
168+
"description": "Name of the system the agent is running on. Will be set to hostname or derived from kubernetes information if not provided.",
164169
"type": ["string", "null"],
165170
"maxLength": 1024
166171
},

0 commit comments

Comments
 (0)