Add ECS information to logger instance#18820
Conversation
Derive information whether ECS logging is enabled from any logger instance as requirement to make decisions about logging keys to use. closes elastic#18815
|
Pinging @elastic/integrations-platforms (Team:Platforms) |
❕ Build Aborted
Expand to view the summary
Build stats
Test stats 🧪
Test errorsExpand to view the tests failures
--------------------- >> end captured stdout << ---------------------- Steps errorsExpand to view the steps failures
Log outputExpand to view the last 100 lines of log output
|
|
test failures seem unrelated |
|
@urso I'd appreciate a review on this. |
|
Why do we want developers to check if ecs enabled? We should encourage structured logging always, but with this check it looks like we will encourage developers to use different 'schemas'. With the current state of structured logging in Beats would we consider a log field being renamed to ECS a breaking change? |
|
IMO renaming a field would be fine, but some changes could lead to type changes, e.g. an when an error was logged as |
|
The error type is internal to logp, right? You think we will have other breaking changes right in Beats/apm-server? |
|
Eg. if the logger is used like this When shipping such logs to ES one would need a new mapping for |
|
After some further discussions, closing this PR. At the moment there is no commitment for not changing the logging format or structure, therefore we will not add the |
What does this PR do?
The PR adds a
ECSEnabled()method to*logp.Loggerinstances.Why is it important?
Since introducing the
logging.ecssetting some minimal required information is logged in ECS format when enabled. To continue work for ECS conformant logging without introducing conflicts with existing log formats, developers need to be able to check for ECS being enabled or not whenever they log information.Checklist
- [ ] I have commented my code, particularly in hard-to-understand areas- [ ] I have made corresponding changes to the documentation- [ ] I have made corresponding change to the default configuration files- [ ] I have added an entry inCHANGELOG.next.asciidocorCHANGELOG-developer.next.asciidoc.How to test this PR locally
run
go test ./libbeat/logp/...Related issues