-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Slowlog format different than regular logs #38642
Comments
Pinging @elastic/es-core-infra |
@almiche I am looking into this, can you please provide log samples or screenshots? |
@pgomulka I'll be adding those shortly. Thanks. |
@pgomulka I have updated the issue with a more accurate description and simpler example. Let me know if you have any further questions I can clarify :) |
@almiche |
you might also find helpful that in version 7 Elasticsearch will use JSON format in logs as well |
Looks like it's working perfect thanks alot @pgomulka |
I will close the issue if that's alright since it's been resolved |
Elasticsearch version (
bin/elasticsearch --version
): 6.6.0Plugins installed: []
JVM version (
java -version
):http://docker.elastic.co/elasticsearch/elasticsearch:6.6.0 (Unchanged from within the image)
OS version (
uname -a
if on a Unix-like system): http://docker.elastic.co/elasticsearch/elasticsearch:6.6.0Description of the problem including expected versus actual behavior:
It seems that slowlogs specifically with elasticsearch have been implemented in such a way which would not allow us to add an extra field in the logs. See below for an explanation.
Below we can see a sample log4j.properties file which is used to specify the pattern layouts used by lo4j. The first
appender.console.layout.pattern
is used to specify the layout of most logs. The same present pattern is reused below for the pattern that log4j is using for slowlogs. The problem is that the log being output is different in both cases.appender.console.layout.pattern = {\"source\":\"elasticsearch_log\",\"msg\":\"%m %throwable\"}%n
appender.index_search_slowlog_rolling.layout.pattern = {\"source\":\"slowlog\",\"msg\":\"%m %throwable\"}%n
Taking a look at the raw output we can see that the log produced by the slowlog appender is does not come out as a valid JSON due to the %m field.
{"source":"slowlog","msg":"[twitter][1] took[153.3micros], took_millis[0], total_hits[0], types[], stats[], search_type[QUERY_THEN_FETCH], total_shards[3], source[{"size":1}], id[], "}
The same is not true for regular logs which are indeed a valid json:
{"source":"elasticsearch_log","msg":"updating [index.search.slowlog.threshold.fetch.trace] from [200ms] to [0s] "}
Steps to reproduce:
Please include a minimal but complete recreation of the problem, including
(e.g.) index creation, mappings, settings, query etc. The easier you make for
us to reproduce it, the more likely that somebody will take the time to look at it.
Provide logs (if relevant):
See images above ^^
The text was updated successfully, but these errors were encountered: