ecs: Using ECS to track the source of errors or exceptions
I’d like to discuss the use case of tracking the source of program errors / exceptions (line numbers, function names, etc) with ECS. These fields may end up under the field sets file
and/or error
.
I’d like to get feedback on how we could approach this. Information we may like to track about where the error was raised:
- error source file
- line number
- error message
- function/method name
- class / module (or other structure) inside which that function/method lives, when appropriate
- error class / standardized name (e.g. literally the class name in an OO language)
- error fields, if any
- error stack trace
Please let me know if there’s anything I’m missing in terms of relevant data to support.
Here’s a suggestion of a mapping for the above:
-
error source file: file.path
-
error.line
(long
) -
error.message
(text
) -
error.function
(keyword
)- the word function is a bit more broad than
method
, IMO, so can serve both use cases.
- the word function is a bit more broad than
-
Error class: error.id
-
Error fields
- Either create a field similar to labels, where people nest their kv attributes or we don’t add it to ECS at first.
-
stack trace:
error.stack_trace
(non indexed) -
@graphaelli or @roncohen I’d like your POV on how you’re doing it currently in APM
-
@ruflin I’d like your opinion on this as well
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 1
- Comments: 21 (16 by maintainers)
Leaving a comment to connect two tickets: https://github.com/elastic/ecs-dotnet/issues/158
In .NET we added stack frames as
nested
back in '15 to our most popular logging integration serilog.sinks.elasticsearch.We are about to release an ECS logging variant of the sink that adheres to ECS and ECS logging more strictly: https://github.com/elastic/ecs-dotnet/tree/main/src/Elastic.CommonSchema.Serilog.Sink
Not being able to persist and query for stack frames is definitely a big feature loss for folks looking to migrate. E.g while
error.type
has the top level exception quite often this shadows the actual offending exception as exceptions get wrapped/rethrown.