JSON logging refactoring and X-Opaque-ID support#41354
JSON logging refactoring and X-Opaque-ID support#41354pgomulka merged 52 commits intoelastic:masterfrom
Conversation
|
Pinging @elastic/es-core-infra |
| System.err.println(wrongLoggerUsage.getErrorLines()); | ||
| wrongUsageFound[0] = true; | ||
| }, args); | ||
| // checkLoggerUsage(wrongLoggerUsage -> { |
There was a problem hiding this comment.
I still need to figure out how to fix this test
There was a problem hiding this comment.
This test is still commented out. We should still make it work?
There was a problem hiding this comment.
absolutely, thanks for reminding!
…csearch into scratch/logging-refactor
|
@elasticmachine run elasticsearch-ci/packaging-sample |
rjernst
left a comment
There was a problem hiding this comment.
Looks good. A few final requests
| super(fieldMap(xOpaqueId), messagePattern, args); | ||
| } | ||
|
|
||
| public static Map<String, Object> fieldMap(String xOpaqueId) { |
| private String esMessageFields; | ||
|
|
||
| public Builder() { | ||
| super(); |
There was a problem hiding this comment.
Looks like this wasn't addressed
| public StoredContext stashContext() { | ||
| final ThreadContextStruct context = threadLocal.get(); | ||
| threadLocal.set(null); | ||
| if(context.requestHeaders.containsKey(Task.X_OPAQUE_ID)) { |
There was a problem hiding this comment.
If we must have this special case, then there should at least be a good explanation in comment on why it is necessary.
minor nit: there are spacing issues in the if and else lines
There was a problem hiding this comment.
added comment and fixed spacing
|
@elasticmachine update branch |
|
@elasticmachine run elasticsearch-ci/packaging-sample |
There was a problem hiding this comment.
I've retested the current state of this PR with elastic/beats#11939 and all still looks good from a Filebeat parsing POV. Thanks!
This is a refactor to current JSON logging to make it more open for extensions and support for custom ES log messages used inDeprecationLogger IndexingSlowLog , SearchSLowLog We want to include x-opaque-id in deprecation logs. The easiest way to have this as an additional JSON field instead of part of the message is to create a custom DeprecatedMessage (extends ESLogMEssage) These messages are regular log4j messages with a text, but also carry a map of fields which can then populate the log pattern. The logic for this lives in ESJsonLayout and ESMessageFieldConverter. Similar approach can be used to refactor IndexingSlowLog and SearchSlowLog JSON logs to contain fields previously only present as escaped JSON string in a message field. closes elastic#41350
…4178) This is a refactor to current JSON logging to make it more open for extensions and support for custom ES log messages used inDeprecationLogger IndexingSlowLog , SearchSLowLog We want to include x-opaque-id in deprecation logs. The easiest way to have this as an additional JSON field instead of part of the message is to create a custom DeprecatedMessage (extends ESLogMEssage) These messages are regular log4j messages with a text, but also carry a map of fields which can then populate the log pattern. The logic for this lives in ESJsonLayout and ESMessageFieldConverter. Similar approach can be used to refactor IndexingSlowLog and SearchSlowLog JSON logs to contain fields previously only present as escaped JSON string in a message field. closes #41350 backport #41354
…allowed (#44587) Deprecation logger was filtering log entries by key, that means that if two log messages with the same key are logged from different users, then the second log messages will be filtered. This change allows to log deprecation message with the same key by different users. relates #41354
…allowed (elastic#44587) Deprecation logger was filtering log entries by key, that means that if two log messages with the same key are logged from different users, then the second log messages will be filtered. This change allows to log deprecation message with the same key by different users. relates elastic#41354
…allowed backport(#44587) #44682 Deprecation logger was filtering log entries by key, that means that if two log messages with the same key are logged from different users, then the second log messages will be filtered. This change allows to log deprecation message with the same key by different users. relates #41354 backport #44587
This is a refactor to current JSON logging to make it more open for extensions
and support for custom ES log messages used in
DeprecationLoggerIndexingSlowLog,SearchSLowLogWe want to include
x-opaque-idin deprecation logs. The easiest way to have this as an additional JSON field instead of part of the message is to create a customDeprecatedMessage(extendsESLogMEssage)These messages are regular log4j messages with a text, but also carry a map of fields which can then populate the log pattern. The logic for this lives in
ESJsonLayoutandESMessageFieldConverter.Similar approach can be used to refactor
IndexingSlowLogandSearchSlowLogJSON logs to contain fields previously only present as escaped JSON string in a message field.closes #41350