21

如何记录来自elasticsearch的请求?

我设置elasticsearch/bin/service/elasticsearch.conf

wrapper.logfile=/var/log/elasticsearch/debug.log

# Log Level for log file output.  (See docs for log levels)
wrapper.logfile.loglevel=DEBUG

但日志文件仅显示:

STATUS | wrapper  | 2012/12/11 13:00:00 | TERM trapped.  Shutting down.
STATUS | wrapper  | 2012/12/11 13:00:02 | <-- Wrapper Stopped
STATUS | wrapper  | 2012/12/11 13:00:05 | --> Wrapper Started as Daemon
STATUS | wrapper  | 2012/12/11 13:00:05 | Java Service Wrapper Community Edition 64-bit 3.5.6
STATUS | wrapper  | 2012/12/11 13:00:05 |   Copyright (C) 1999-2010 Tanuki Software, Ltd. All Rights Reserved.
STATUS | wrapper  | 2012/12/11 13:00:05 |     http://wrapper.tanukisoftware.com
STATUS | wrapper  | 2012/12/11 13:00:05 | 
WARN   | wrapper  | 2012/12/11 13:00:05 | The value of wrapper.java.command does not appear to be a java binary.
WARN   | wrapper  | 2012/12/11 13:00:05 | The use of scripts is not supported. Trying to continue, but some features may not work correctly..
STATUS | wrapper  | 2012/12/11 13:00:05 | Launching a JVM...
INFO   | jvm 1    | 2012/12/11 13:00:05 | WrapperManager: Initializing...

没有关于我的请求的信息...

我用elasticsearch 0.17.6

4

3 回答 3

13

elasticsearch 0.17.6 中没有可用的请求日志记录工具。0.18.3及以上版本支持慢搜索操作的日志记录,可以配置0ms的阈值来记录所有分片的所有搜索请求。在 0.19.12 版本中,此功能也扩展到索引查询

如果您对记录所有 HTTP 请求感兴趣, elasticsearch -jetty插件支持 elasticsearch 0.18.4 及更高版本的此功能。

于 2012-12-11T16:29:44.757 回答
4

在 1.7.3 中

配置/elasticsearch.yml

index.search.slowlog.threshold.query.debug: 0s
index.search.slowlog.threshold.fetch.debug: 0s
index.indexing.slowlog.threshold.index.debug: 0s

配置/日志记录.yml

  index.search.slowlog: DEBUG, index_search_slow_log_file
  index.indexing.slowlog: DEBUG, index_indexing_slow_log_file

additivity:
  index.search.slowlog: true
  index.indexing.slowlog: true
于 2016-07-18T11:23:52.980 回答
3

在 Elasticsearch 5.x 及更高版本中配置日志记录的首选方法是使用 API:

## Elasticsearch slow log
curl -X "PUT" "http://localhost:9200/test_resumes/_settings?preserve_existing=true" \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "index": {
    "search.slowlog.threshold.query.trace": "0ms",
    "search.slowlog.threshold.fetch.trace": "0ms",
    "search.slowlog.level": "trace"
  }
}'
于 2018-05-15T16:55:50.737 回答