差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

Both sides previous revision 前次修改
下次修改
前次修改
java:elastic:elasticsearch [2016/12/13 00:48]
tony [Ant中將logging設定改為rolling file]
java:elastic:elasticsearch [2023/06/25 09:48] (目前版本)
行 1: 行 1:
 {{tag>​elasticsearch java}} {{tag>​elasticsearch java}}
 ====== elasticsearch ====== ====== elasticsearch ======
-==== Ant中將logging設定改為rolling file ====+===== 透過ant預設logging.yml設定改為rolling file ====
 +目標是要將 
 +<​code>​ 
 +  file: 
 +    type: dailyRollingFile 
 +    file: ${path.logs}/​${cluster.name}.log 
 +    datePattern:​ "'​.'​yyyy-MM-dd"​ 
 +    layout: 
 +      type: pattern 
 +      conversionPattern:​ "​[%d{ISO8601}][%-5p][%-25c] %.10000m%n"​ 
 +</​code> ​     
 +修改為 
 +<​code>​ 
 +  file: 
 +    type: rollingFile 
 +    file: ${path.logs}/​${cluster.name}.log 
 +    maxFileSize:​ 8000KB 
 +    maxBackupIndex:​ 10 
 +    layout: 
 +      type: pattern 
 +      conversionPattern:​ "​[%d{ISO8601}][%-5p][%-25c] %.10000m%n"​ 
 +</​code>​ 
 +ant內容如下:​
 <code xml> <code xml>
 <​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="​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"/>​ <​replaceregexp file="​config/​logging.yml"​ match="​[ \t]*datePattern:​ .*[\r\n]*"​ replace=""​ flags="​g"/>​
 </​code>​ </​code>​
-==== Reference ====+===== 打開search與index的debug ===== 
 +在使用預設的loggin.yml情況下,新增以下內容到elasticsearch.yml:​ 
 +<​code>​ 
 +index.search.slowlog.threshold.query.debug:​ 0s 
 +index.search.slowlog.threshold.fetch.debug:​ 0s 
 +index.indexing.slowlog.threshold.index.debug:​ 0s 
 +</​code>​ 
 +接著使用rest client去操作elasticsearch:​ 
 +<​code>​ 
 +curl http://​127.0.0.1:​9200/​_search 
 +</​code>​ 
 +最後就可以查看index_search_slowlog.log的內容;裡面要有資料才會有log產生。 
 +===== Reference ​=====
   * [[http://​elasticsearch-users.115913.n3.nabble.com/​log-file-rolling-by-size-td4025190.html|設定rolling file by size的方法]]   * [[http://​elasticsearch-users.115913.n3.nabble.com/​log-file-rolling-by-size-td4025190.html|設定rolling file by size的方法]]
- +  * [[https://​gist.github.com/​reyjrar/​4364063|設定threadpool]] 
 +  * [[https://​www.elastic.co/​guide/​en/​elasticsearch/​reference/​2.1/​index-modules-slowlog.html|showlog設定]] 預設都disable 
 +  * [[https://​www.elastic.co/​guide/​en/​elasticsearch/​guide/​current/​logging.html|by index的log設定]] 
 +  * [[http://​www.slideshare.net/​rueian3/​elasticsearch-45855699|elasticsearch簡介]] 
 +  * [[http://​www.openskill.cn/​article/​257|分析gc of log file]] 
 +  * [[http://​www.jianshu.com/​p/​fa31f38d241e|使用ElasticSearch踩过的坑]]