在弹性search泊坞窗容器中找不到日志

我使用以下参数运行公共弹性search容器:

docker run -d -v /elasticsearch/data:/usr/share/elasticsearch/data -p 9200:9200 -p 9300:9300 --name my_elastic_search elasticsearch:2.4.1 -Des.cluster.name="elastic_search_name" 

我有兴趣得到日志,但我没有find他们的运气。 他们应该在哪里? 我查看了/var/log/elasticsearch/usr/share/elasticsearch/logs ,这两个目录都是空的

2.4.x标记的docker容器中的默认日志loggingconfiguration不启用文件日志logging。 一个解决scheme是将elasticsearch config文件夹映射到您自己的包含logging.yml文件(以及一个elasticsearch.yml文件和scripts文件夹!)的卷。

docker run -d -v /elasticsearch/config:/usr/share/elasticsearch/config -v /elasticsearch/data:/usr/share/elasticsearch/data -p 9200:9200 -p 9300:9300 --name my_elastic_search elasticsearch:2.4.1 -Des.cluster.name="elastic_search_name"

您的日志loggingconfiguration必须包含所需的文件appender,例如此处显示的默认值:

 # you can override this using by setting a system property, for example -Des.logger.level=DEBUG es.logger.level: INFO rootLogger: ${es.logger.level}, console, file logger: # log action execution errors for easier debugging action: DEBUG # deprecation logging, turn to DEBUG to see them deprecation: INFO, deprecation_log_file # reduce the logging for aws, too much is logged under the default INFO com.amazonaws: WARN # aws will try to do some sketchy JMX stuff, but its not needed. com.amazonaws.jmx.SdkMBeanRegistrySupport: ERROR com.amazonaws.metrics.AwsSdkMetrics: ERROR org.apache.http: INFO # gateway #gateway: DEBUG #index.gateway: DEBUG # peer shard recovery #indices.recovery: DEBUG # discovery #discovery: TRACE index.search.slowlog: TRACE, index_search_slow_log_file index.indexing.slowlog: TRACE, index_indexing_slow_log_file additivity: index.search.slowlog: false index.indexing.slowlog: false deprecation: false appender: console: type: console layout: type: consolePattern conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n" file: type: dailyRollingFile file: ${path.logs}/${cluster.name}.log datePattern: "'.'yyyy-MM-dd" layout: type: pattern conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %.10000m%n" # Use the following log4j-extras RollingFileAppender to enable gzip compression of log files. # For more information see https://logging.apache.org/log4j/extras/apidocs/org/apache/log4j/rolling/RollingFileAppender.html #file: #type: extrasRollingFile #file: ${path.logs}/${cluster.name}.log #rollingPolicy: timeBased #rollingPolicy.FileNamePattern: ${path.logs}/${cluster.name}.log.%d{yyyy-MM-dd}.gz #layout: #type: pattern #conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n" deprecation_log_file: type: dailyRollingFile file: ${path.logs}/${cluster.name}_deprecation.log datePattern: "'.'yyyy-MM-dd" layout: type: pattern conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n" index_search_slow_log_file: type: dailyRollingFile file: ${path.logs}/${cluster.name}_index_search_slowlog.log datePattern: "'.'yyyy-MM-dd" layout: type: pattern conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n" index_indexing_slow_log_file: type: dailyRollingFile file: ${path.logs}/${cluster.name}_index_indexing_slowlog.log datePattern: "'.'yyyy-MM-dd" layout: type: pattern conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"