在执行MLT时更缺少Elasticsearch中的日志记录(更像是这样)查询

时间:2016-01-04 14:13:44

标签: logging elasticsearch morelikethis

我在 ElasticSearch 中使用更像查询,问题是,由于某种原因,此查询未出现在日志文件中。我已经尝试了几个日志级别,如DEBUG,INFO,但这并没有给我一个解决方案。

ElasticSearch wiki对于记录此类查询也没有提及。

logging.yml

# you can override this using by setting a system property, for example -Des.logger.level=DEBUG
es.logger.level: DEBUG
rootLogger: ${es.logger.level}, console, file
logger:
  # log action execution errors for easier debugging
  action: DEBUG
  # reduce the logging for aws, too much is logged under the default INFO
  com.amazonaws: WARN

  # 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

appender:
  console:
    type: console
    layout:
      type: consolePattern
      conversionPattern: "[%d{ISO8601}][%-5p][%-25c{2}] %m%n"

  file:
    type: dailyRollingFile
    file: ${path.logs}/${cluster.name}.log
    datePattern: "'.'yyyy-MM-dd"
    layout:
      type: pattern
      conversionPattern: "[%d{ISO8601}][%-5p][%-25c{2}] %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{2}] %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{2}] %m%n"

2 个答案:

答案 0 :(得分:2)

如果要查看ES服务器收到的more_like_this查询,可以确保将其隐藏到slow log file。要实现这一点,您只需要像这样调整elasticsearch.yml配置文件(最后)。取消注释以下行并将值更改为非常低的值,例如1ms

index.search.slowlog.threshold.query.trace: 1ms

重新启动ES服务器后,其效果是ES服务器收到的每个查询都将记录在慢速日志文件中,包括more_like_this查询。

答案 1 :(得分:1)

您的查询可能太快而无法记录在慢速日志文件中。降低elasticsearch.yml文件或索引设置中的慢速日志阈值。您甚至可以使用0ms阈值来记录每个查询。有关详细信息,请参阅Slow Log referenceLogging Secrets blog post