记录elasticsearch请求

时间:2012-12-11 13:05:19

标签: logging elasticsearch

如何记录来自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

3 个答案:

答案 0 :(得分:10)

elasticsearch 0.17.6中没有可用的请求记录功能。版本0.18.3及更高版本支持logging of slow search operations,可以配置阈值为0ms来记录所有分片的所有搜索请求。在版本0.19.12中,此功能已扩展为index queries as well

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

答案 1 :(得分:3)

在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

配置/ logging.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

答案 2 :(得分:0)

在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"
  }
}'