logging – 无法在Elastic search docker容器中找到日志

前端之家收集整理的这篇文章主要介绍了logging – 无法在Elastic search docker容器中找到日志前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我正在使用以下参数运行公共弹性搜索容器:

  1. 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"

我对获取日志很感兴趣,但我找不到它们.他们应该在哪里?我查看了/ var / log / elasticsearch和/usr/share / elasticsearch / logs,这两个目录都是空的

最佳答案
2.4.x标记的docker容器中的默认日志记录配置不启用文件日志记录.解决方案是将elasticsearch配置文件夹映射到您自己的卷,其中包含logging.yml文件(以及elasticsearch.yml文件和脚本文件夹!)

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”

您的日志记录配置必须包含所需的文件追加程序,例如此处显示的默认值:

  1. # you can override this using by setting a system property,for example -Des.logger.level=DEBUG
  2. es.logger.level: INFO
  3. rootLogger: ${es.logger.level},console,file
  4. logger:
  5. # log action execution errors for easier debugging
  6. action: DEBUG
  7. # deprecation logging,turn to DEBUG to see them
  8. deprecation: INFO,deprecation_log_file
  9. # reduce the logging for aws,too much is logged under the default INFO
  10. com.amazonaws: WARN
  11. # aws will try to do some sketchy JMX stuff,but its not needed.
  12. com.amazonaws.jmx.SdkMBeanRegistrySupport: ERROR
  13. com.amazonaws.metrics.AwsSdkMetrics: ERROR
  14. org.apache.http: INFO
  15. # gateway
  16. #gateway: DEBUG
  17. #index.gateway: DEBUG
  18. # peer shard recovery
  19. #indices.recovery: DEBUG
  20. # discovery
  21. #discovery: TRACE
  22. index.search.slowlog: TRACE,index_search_slow_log_file
  23. index.indexing.slowlog: TRACE,index_indexing_slow_log_file
  24. additivity:
  25. index.search.slowlog: false
  26. index.indexing.slowlog: false
  27. deprecation: false
  28. appender:
  29. console:
  30. type: console
  31. layout:
  32. type: consolePattern
  33. conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"
  34. file:
  35. type: dailyRollingFile
  36. file: ${path.logs}/${cluster.name}.log
  37. datePattern: "'.'yyyy-MM-dd"
  38. layout:
  39. type: pattern
  40. conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %.10000m%n"
  41. # Use the following log4j-extras RollingFileAppender to enable gzip compression of log files.
  42. # For more information see https://logging.apache.org/log4j/extras/apidocs/org/apache/log4j/rolling/RollingFileAppender.html
  43. #file:
  44. #type: extrasRollingFile
  45. #file: ${path.logs}/${cluster.name}.log
  46. #rollingPolicy: timeBased
  47. #rollingPolicy.FileNamePattern: ${path.logs}/${cluster.name}.log.%d{yyyy-MM-dd}.gz
  48. #layout:
  49. #type: pattern
  50. #conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"
  51. deprecation_log_file:
  52. type: dailyRollingFile
  53. file: ${path.logs}/${cluster.name}_deprecation.log
  54. datePattern: "'.'yyyy-MM-dd"
  55. layout:
  56. type: pattern
  57. conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"
  58. index_search_slow_log_file:
  59. type: dailyRollingFile
  60. file: ${path.logs}/${cluster.name}_index_search_slowlog.log
  61. datePattern: "'.'yyyy-MM-dd"
  62. layout:
  63. type: pattern
  64. conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"
  65. index_indexing_slow_log_file:
  66. type: dailyRollingFile
  67. file: ${path.logs}/${cluster.name}_index_indexing_slowlog.log
  68. datePattern: "'.'yyyy-MM-dd"
  69. layout:
  70. type: pattern
  71. conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"

猜你在找的Docker相关文章