![ElasticSearch Cookbook(Second Edition)](https://wfqqreader-1252317822.image.myqcloud.com/cover/226/36704226/b_36704226.jpg)
Changing logging settings
Standard logging settings work very well for general usage.
Changing the log level can be useful when checking for bugs, or to understand malfunctions due to a bad configuration or strange plugin behavior. A verbose log can be used from the ElasticSearch community to cover problems.
If you need to debug your ElasticSearch server or change how the logging works (such as remotely sending events), you need to change the logging.yml
parameters.
Getting ready
You need a working ElasticSearch Server installed.
How to do it...
In the config
directory of your ElasticSearch installation directory, there is a logging.yml
file that controls the work settings.
You need to perform the following steps to change the logging settings:
- Omit every kind of logging that ElasticSearch has. Take for example the root level logging here:
rootLogger: INFO, console, file
Now, change the root level logging using this:
rootLogger: DEBUG, console, file
- Now, if you start ElasticSearch from the command line (with
bin/elasticsearch –f
), you should see a lot of garbage text that looks as follows:[…][INFO ][node] [ESCookBook] version[1.4.0.Beta1],pid[32363], build[1f25669/2014-10-01T14:58:15Z] […][INFO ][node] [ESCookBook] initializing … […][DEBUG][node] [ESCookBook] using home [/opt/elasticsearch-1.4.0.Beta1], config [/opt/elasticsearch-1.4.0.Beta1/config], data [[/opt/elasticsearch-1.4.0.Beta1/data]], logs [/opt/elasticsearch-1.4.0.Beta1/logs], work [/opt/elasticsearch-1.4.0.Beta1/work], plugins [/opt/elasticsearch-1.4.0.Beta1/plugins] […][INFO ][plugins ] [ESCookBook] loaded [], sites [head] […][DEBUG][common.compress.lzf] using encoder [VanillaChunkDecoder] and decoder[{}] […][DEBUG][env ] [ESCookBook] using node location [[/opt/elasticsearch-1.4.0.Beta1/data/elasticsearch/nodes/0]], local_node_id [0] […][DEBUG][threadpool] [ESCookBook] creating thread_pool [generic], type [cached], keep_alive [30s] […][DEBUG][threadpool] [ESCookBook] creating thread_pool [index], type [fixed], size [8], queue_size [200] […][DEBUG][threadpool] [ESCookBook] creating thread_pool [bulk], type [fixed], size [8], queue_size [50] … (truncated)…
How it works...
The ElasticSearch logging system is based on the Log4j library (http://logging.apache.org/log4j/). Log4j is a powerful library that manages logging, so covering all the functionalities of this library is outside the scope of this book. If a user needs advanced usage, there are a lot of books and articles available on the Internet.