1

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

ElasticSearch wiki 也对记录此类查询保持沉默。

日志记录.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"
4

2 回答 2

2

如果要查看more_like_thisES 服务器收到的查询,可以通过确保它被下沉到慢日志文件来实现。为此,您只需elasticsearch.yml像这样调整配置文件(最后)。取消注释以下行并将值更改为非常低的值,例如1ms

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

重启你的 ES 服务器后,这样做的效果是你的 ES 服务器接收到的每个查询都将记录在慢日志文件中,包括你的more_like_this查询。

于 2016-01-04T14:47:20.830 回答
1

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

于 2016-01-04T14:44:08.097 回答