Find out about SOLR's slow query through Tomcat logs

Source: Internet
Author: User
Tags json rar solr tomcat

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/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.