-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Formatting of stacktraces #25
Comments
There's no fundamental problem with making the Logs UI aware of a well-defined exception format and with rendering such exceptions.
If the exception itself contained a language specifier we could add formatters for them (at an increased maintenance cost). But wouldn't one of the big advantages of an abstract exception format be that it is language-independent? |
in Elasticsearch exceptions are formatted as a JSON array where each element represent a line from a stactrace. This the allows to be formatted nicely in logs and hopefully is still readable. |
So it's an array of opaque strings? What's the advantage compared to just one string? |
readability. if you output a stactrace as a one (escaped) string in a json it will end up very long and won't give you much help. |
Thanks for the feedback so far. Here's my proposal:
Similar to this: ..., "stack": [
{"class": "org.elasticsearch.common.logging.JsonLoggerTests", "method": "testStacktrace", "line": 125},
{"class": "org.elasticsearch.common.logging.JsonLoggerTests", "method": "testStacktrace", "line": 125}
] That means we can start out with the status quo, which is including the opaque stack trace in the The structured stack trace should support cause chains, suppressed exceptions and omission of common frames ( Example:
|
@felixbarny sounds like a plan, but I am a bit worried that the logs would end up too verbose. Give it a go, maybe the it won't be that bad. We can also ask for others opinions on whether this is acceptable. |
I don't think that JSON logs have to be as readable as plain-text ones. After all, the intention is to view them via the Logs UI, for example. But I agree that they should be decently readable in scenarios where the logs don't make it to Elasticsearch for whatever reason. For development, you'd probably use plain-text logs anyways, no? |
I agree they certainly won't be as readable as plain-text, but at the same time the goal behind using JSON is to keep them human readable. Verbosity and formatting are crucial I guess. Plain text logs are just kept for backwards compatibility - to give time users to migrate. We will likely remove them in the future. Not sure which version yet. Users and developers who will keep on visually check they logs should also be taken into consideration here once we will keep JSON logs only. |
From a schema perspective, the Windows event logs are another event source that have main messages that are (really) big pieces of structured text. So multiline The idea of breaking out the stack trace into structured parts is interesting, and definitely worth looking into. But I don't think it has to be one or the other, however. I think it could also be an option that people enable, if they see the value, and agree with the added storage. But after all, whether it's additive or replaces / streamlines the content of |
I have thought about that a little more and I think we don't have to come up with a schema for parsed stack traces just yet. I've created elastic/ecs#562 to have a dedicated I've prototyped adding the plain-text stack trace as an array so that it's human-readable:
The Filebeat configuration is a bit more complex with that setup, that's why I would disable that by default. When it's enabled it's actually feasible to only have JSON logs as they are pretty human-readable. |
closed via #28 |
Currently, the exception stack trace is just part of the message. There are some advantages and disadvantages to this.
The advantage is that it integrates nicely in the logs UI:
There's no additional configuration required to see a stack trace which is natively rendered and looks just the same as in a regular log file.
The disadvantage is that the whole stack trace is squashed into a single JSON line which makes them non-human readable.
Alternatives:
cc @pgomulka @ruflin @webmat @weltenwort
related: elastic/ecs#154
The text was updated successfully, but these errors were encountered: