Support Questions
Find answers, ask questions, and share your expertise
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

What are good Solr logging options to capture each query and its corresponding stats?

What are good Solr logging options to capture each query and its corresponding stats?

New Contributor

Solr offers nice granularity when it comes to choosing what gets logged in solr.log. These logging levels can be set online, through the Admin UI, or via log4j properties.

I want to capture both the text of all queries and the corresponding stats (such as 'hits=123 status=0 QTime=60')

I have set the root logger to WARN and I've set the following 2 specific logging levels in

This gives me pairs of lines in the log, such as the following:

2017-08-16 08:55:53.063 DEBUG (qtp1348949648-8148677) [c:XXX s:shard1 r:core_node2 x:XXX_shard1_replica1] o.a.s.s.s.LocalStatsCache ## GET {q=typography&df=_text_&indent=true&echoParams=explicit&start=0&json={"params":{"q":"typography","start":0,"rows":10,"wt":"json"}}&rows=10&wt=json}
2017-08-16 08:55:53.069 INFO (qtp1348949648-8148677) [c:XXX s:shard1 r:core_node2 x:XXX_shard1_replica1] o.a.s.c.S.Request [XXX_shard1_replica1] webapp=/solr path=/query params={indent=true&wt=json} hits=0 status=0 QTime=6

This achieves what I want: I get the query (q:typography) and the stats (hits=0 status=0 QTime=6).

However the DEBUG level on also gives me a fair bit of other noise and seems a bit heavy-handed. Also, the two lines are not necessarily adjacent in the log, so tying the query to the stats can be difficult.

Is this the best way to achieve my aim (of getting the query and the stats in the log)? Are there better logging options that I could choose? This solution was derived by trying a few random options. Is there a resource that matches log lines to the corresponding logging levels?

(Note. I am running Solr V6.6.0)



Don't have an account?
Coming from Hortonworks? Activate your account here