Tomcat's log is as follows, I want to find out some very slow queries
Wrote
182460138 [http-nio-8080-exec-13] INFO org.apache.solr.core.SolrCore "[Collection1] WEBAPP=/SOLR4 Path=/select ={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 code
now=$ (date + "%y-%m-%d")
logfile= "slow_query. $NOW. Log"
$ (touch/var/log/tomcat6/$LOGFILE)
# # 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) > = The ' >/var/log/tomcat6/$LOGFILE)
This Linux script can detect records larger than 800MS.
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/Java/