当前位置:天才代写 > tutorial > JAVA 教程 > 通过TOMCAT的日志查出SOLR的慢查询

通过TOMCAT的日志查出SOLR的慢查询

2017-11-02 08:00 星期四 所属: JAVA 教程 浏览:433

TOMCAT的日志如下, 我想查出一些很慢的查询

写道

182460138 [http-nio-8080-exec-13] INFO org.apache.solr.core.SolrCore “ [collection1] webapp=/solr4 path=/select params={spellcheck=true&mm=1&spellcheck.q=imbd+rar&qf=content^40&qf=label^5.0&qf=tags_inline^1.0&qf=taxonomy_names^2.0&qf=tos_name^3.0&qf=ts_comments^20&json.nl=map&f.content.hl.maxAlternateFieldLength=256&hl.fl=content&wt=json&hl=true&rows=10&pf=content^2.0&fl=id,entity_id,entity_type,bundle,bundle_name,label,ss_language,is_comment_count,ds_created,ds_changed,score,path,url,is_uid,tos_name,ss_field_image_uri&hl.snippets=3&start=40100&q=imbd+rar&f.content.hl.alternateField=teaser&hl.mergeContigious=true&fq=ds_created:[2013-03-06T19:27:45Z+TO+*]&fq=(access_node_me2ntd_all:0+OR+access__all:0)&ps=15} hits=36428 status=0 QTime=25

Java代码

NOW=$(date +"%Y-%m-%d")  
LOGFILE="slow_query.$NOW.log"
$(touch /var/log/tomcat6/$LOGFILE)  
## 800 msec is a maximum value for solr. Let's filter everything above that  
$(cat /var/log/tomcat6/catalina.out | grep 'QTime' | awk -F 'QTime=' 'int($NF) >= 800' > /var/log/tomcat6/$LOGFILE)

这段linux剧本就能查出大于800MS的记录

查察本栏目

 

    关键字:

天才代写-代写联系方式