elasticsearch
透過ant將預設logging.yml設定改為rolling file
目標是要將
file: type: dailyRollingFile file: ${path.logs}/${cluster.name}.log datePattern: "'.'yyyy-MM-dd" layout: type: pattern conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %.10000m%n"修改為
file: type: rollingFile file: ${path.logs}/${cluster.name}.log maxFileSize: 8000KB maxBackupIndex: 10 layout: type: pattern conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %.10000m%n"ant內容如下:
<replaceregexp file="config/logging.yml" match="type: dailyRollingFile" replace="type: rollingFile${line.separator} maxFileSize: 8000KB${line.separator} maxBackupIndex: 10" flags="g"/> <replaceregexp file="config/logging.yml" match="[ \t]*datePattern: .*[\r\n]*" replace="" flags="g"/>
打開search與index的debug
在使用預設的loggin.yml情況下,新增以下內容到elasticsearch.yml:
index.search.slowlog.threshold.query.debug: 0s index.search.slowlog.threshold.fetch.debug: 0s index.indexing.slowlog.threshold.index.debug: 0s接著使用rest client去操作elasticsearch:
curl http://127.0.0.1:9200/_search最後就可以查看index_search_slowlog.log的內容;裡面要有資料才會有log產生。