Skip to content

Commit 0897078

Browse files
authored
fix: update remaining cases where ecs.version was not a top-level field (#151)
Changes in #150 missed these. Then the subsequent spec update (#135) resulted in tests being broken by those missing cases.
1 parent 54fdf8e commit 0897078

File tree

3 files changed

+7
-17
lines changed

3 files changed

+7
-17
lines changed

helpers/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ const ecs = {
3232
log: {
3333
logger: 'test'
3434
},
35-
ecs: {
36-
version: '1.4.0'
37-
}
35+
'ecs.version': '1.4.0'
3836
}
3937

4038
console.log(stringify(ecs))

helpers/test/basic.test.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ test('stringify should return a valid ecs json', t => {
4747
'@timestamp': new Date().toISOString(),
4848
'log.level': 'info',
4949
message: 'hello world',
50-
ecs: {
51-
version: '1.4.0'
52-
}
50+
'ecs.version': '1.4.0'
5351
}
5452

5553
const line = stringify(ecsFields)
@@ -64,9 +62,7 @@ test('bad ECS json on purpose: @timestamp', t => {
6462
'@timestamp': 'not a date',
6563
'log.level': 'info',
6664
message: 'foo',
67-
ecs: {
68-
version: '1.4.0'
69-
}
65+
'ecs.version': '1.4.0'
7066
}
7167

7268
const line = stringify(ecsFields)
@@ -133,9 +129,7 @@ test('formatHttpRequest and formatHttpResponse should return a valid ecs object'
133129
'@timestamp': new Date().toISOString(),
134130
'log.level': 'info',
135131
message: 'hello world',
136-
ecs: {
137-
version: '1.4.0'
138-
}
132+
'ecs.version': '1.4.0'
139133
}
140134

141135
const resBody = 'ok'
@@ -235,9 +229,7 @@ test('stringify should emit valid tracing fields', t => {
235229
'@timestamp': new Date().toISOString(),
236230
'log.level': 'info',
237231
message: 'hello world',
238-
ecs: {
239-
version: '1.4.0'
240-
},
232+
'ecs.version': '1.4.0',
241233
trace: { id: 1 },
242234
transaction: { id: 2 },
243235
span: { id: 3, extra_fields: 'are dropped' }

loggers/pino/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ child.warn('From child')
3838
Running this will produce log output similar to the following:
3939

4040
```sh
41-
{"log.level":"info","@timestamp":"2021-01-19T22:51:12.142Z","ecs":{"version":"1.6.0"},"process":{"pid":82240},"host":{"hostname":"pink.local"},"message":"Hello world"}
42-
{"log.level":"warn","@timestamp":"2021-01-19T22:51:12.143Z","ecs":{"version":"1.6.0"},"process":{"pid":82240},"host":{"hostname":"pink.local"},"module":"foo","message":"From child"}
41+
{"log.level":"info","@timestamp":"2023-10-16T18:08:02.601Z","process.pid":74325,"host.hostname":"pink.local","ecs.version":"1.6.0","message":"Hello world"}
42+
{"log.level":"warn","@timestamp":"2023-10-16T18:08:02.602Z","process.pid":74325,"host.hostname":"pink.local","ecs.version":"1.6.0","module":"foo","message":"From child"}
4343
```
4444

4545
Please see the [Node.js ECS pino documentation](https://www.elastic.co/guide/en/ecs-logging/nodejs/current/pino.html) for more.

0 commit comments

Comments
 (0)