In cases of advanced troubleshooting of Elasticsearch issues, it may be necessary at times to increase the verbosity of a specific logger within Elasticsearch. Unlike with Logstash, the loggers in Elasticsearch aren't specifically documented as there are far too many (thousands+).
Note: Running this tool will result in the cloning of the Elasticsearch repo locally if it doesn't already exist within the specified repo_dir
Syntax: es-logger-finder -r <PATH_TO_ELASTICSEARCH_GIT_DIR> -v <ES_MAJOR_MINOR_VERSION> -p '<LOGGER_PATTERN>' -c <CACHE_FILE_DIR> [-f|-d]
options:
-r | --repo_dir Specify the local directory of the Elasticsearch git repo
-v | --es_version Specify the version of Elasticsearch to use (MAJOR.MINOR)
-f | --force_update Pull latest changes from remote down to local elasticsearch repo
-c | --cache_dir Specify the path to the directory the pre-generated files containing all loggers
-p | --logger_pattern Pattern to use when searching for a specific logger
-d | --debug Enable debug mode
In a case you wanted to increase the logging verbosity for all packages relating to searchable snapshots in Elasticsearch 7.14, you would run the following command to identify those relevant logers:
./find-loggers -r /home/user1/git_projects/elasticsearch/ -v 7.14 -p 'snapshots' -c /home/user1/es-logger-finder/
2021-12-17T22:54:14-0500 [INFO] Serching for loggers matching 'snapshot' in v7.14 ...
Already on '7.14'
Your branch is up to date with 'origin/7.14'.
--------------------- RESULTS -----------------------
org.elasticsearch.action.admin.cluster.snapshots
org.elasticsearch.action.admin.cluster.snapshots.clone
org.elasticsearch.action.admin.cluster.snapshots.create
org.elasticsearch.action.admin.cluster.snapshots.delete
org.elasticsearch.action.admin.cluster.snapshots.features
org.elasticsearch.action.admin.cluster.snapshots.get
org.elasticsearch.action.admin.cluster.snapshots.restore
org.elasticsearch.action.admin.cluster.snapshots.status
org.elasticsearch.client.searchable_snapshots
org.elasticsearch.client.snapshots
org.elasticsearch.http.snapshots
org.elasticsearch.index.snapshots
org.elasticsearch.index.snapshots.blobstore
org.elasticsearch.snapshots
org.elasticsearch.snapshots.mockstore
org.elasticsearch.snapshots.sourceonly
org.elasticsearch.xpack.core.ml.job.snapshot.upgrade
org.elasticsearch.xpack.core.searchablesnapshots
org.elasticsearch.xpack.ml.job.snapshot.upgrader
org.elasticsearch.xpack.ml.modelsnapshots
org.elasticsearch.xpack.ml.rest.modelsnapshots
org.elasticsearch.xpack.searchablesnapshots
org.elasticsearch.xpack.searchablesnapshots.action
org.elasticsearch.xpack.searchablesnapshots.action.cache
org.elasticsearch.xpack.searchablesnapshots.allocation
org.elasticsearch.xpack.searchablesnapshots.allocation.decider
org.elasticsearch.xpack.searchablesnapshots.cache.blob
org.elasticsearch.xpack.searchablesnapshots.cache.common
org.elasticsearch.xpack.searchablesnapshots.cache.full
org.elasticsearch.xpack.searchablesnapshots.cache.shared
org.elasticsearch.xpack.searchablesnapshots.hdfs
org.elasticsearch.xpack.searchablesnapshots.minio
org.elasticsearch.xpack.searchablesnapshots.preallocate
org.elasticsearch.xpack.searchablesnapshots.recovery
org.elasticsearch.xpack.searchablesnapshots.rest
org.elasticsearch.xpack.searchablesnapshots.s3
org.elasticsearch.xpack.searchablesnapshots.store
org.elasticsearch.xpack.searchablesnapshots.store.input
org.elasticsearch.xpack.searchablesnapshots.upgrade
-----------------------------------------------------
Total matching loggers: 39
-----------------------------------------------------
In the list you can see the org.elasticsearch.xpack.searchablesnapshots
logger has been indentified. You can then dynamically update the log level for this logger via the DevTools console:
PUT /_cluster/settings
{
"persistent": {
"logger.org.elasticsearch.xpack.searchablesnapshots: "DEBUG"
}
}
or via a curl call:
curl -XPUT https://my-elasticsearch-host:9200/_cluster/settings -H 'Content-Type: application/json' -d'{"persistent": {"logger.org.elasticsearch.xpack.searchablesnapshots":"DEBUG"}}'
Once you've completed your investigation, you can then unset the logger to return it to its default log level:
PUT /_cluster/settings
{
"persistent": {
"logger.org.elasticsearch.xpack.searchablesnapshots: null
}
}