Skip to content

Commit c7184a6

Browse files
authored
Relax requirements on field order to allow for frameworks that cannot (#50)
This relaxes the language and spec on the field order of @timestamp, log.level, message for frameworks (notably pino and zap) that cannot support it. Fixes: #42
1 parent b1daab5 commit c7184a6

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

docs/intro.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ ECS-compatible JSON doesn't require the use of Logstash or grok parsing via an i
5050
*Decently human-readable JSON structure*::
5151
+
5252
--
53-
The first three fields are always `@timestamp`, `log.level` and `message`.
53+
The first three fields are `@timestamp`, `log.level` and `message`.
5454
It's also possible to format stack traces so that each element is rendered in a new line.
5555
--
5656

spec/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The specification aims to keep uniformity accross the libraries and to provide a human digestible output while producing a structured format.
44

5-
The ordering of the next three keys must be respected in every ecs-logging library:
5+
The ordering of the next three keys must be respected in every ecs-logging library (unless the logging framework makes this impossible):
66

77
1. `@timestamp`, base field
88
2. `log.level`, log field

spec/spec.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99
"type": "datetime",
1010
"required": true,
1111
"index": 0,
12-
"url": "https://www.elastic.co/guide/en/ecs/current/ecs-base.html"
12+
"url": "https://www.elastic.co/guide/en/ecs/current/ecs-base.html",
13+
"comment": [
14+
"Field order, as specified by 'index', is RECOMMENDED.",
15+
"ECS loggers must implement field order unless the logging framework makes that impossible."
16+
]
1317
},
1418
"log.level": {
1519
"type": "string",

0 commit comments

Comments
 (0)