lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Prateek Jain J <prateek.j.j...@ericsson.com>
Subject RE: logging query received
Date Fri, 17 Feb 2017 16:39:46 GMT

Thanks Alexandre,

 I was on a load server so, couldn't change any code but I just enabled debug logging from
Admin UI and I was able to see query in solr log file; which I turned off after 5 minutes.
Thanks again for full list of options available for various scenarios.


Regards,
Prateek Jain

-----Original Message-----
From: Alexandre Rafalovitch [mailto:arafalov@gmail.com] 
Sent: 17 February 2017 02:33 PM
To: solr-user <solr-user@lucene.apache.org>
Subject: Re: logging query received

There is actually several ways to answer this depending on the level of precision your situation
requires. And, of course, there are trade-offs.

One issue to keep in mind is what you mean by "parameters". Do you want to include all the
explicit defaults and overrides that the Request Handler will add itself? Or just what the
calling URL has. Logging at different steps will give you different answers here. Also, some
parameters can be sent in the request body, not just in the URL.

Now in terms of options:

One answer is that logging should be happening in the middleware that talks to Solr. That's
where you transform UI requests into what will go to Solr and you already have the code to
log it anyway you want. But that's harder if you have multiple clients all talking to Solr
or if you have trust in your smart-firewall and expose Solr directly to the web.

The next option is to enable standard HTTP access log on the bundled Jetty level. However,
Jetty is an implementation detail, so you should keep that in mind as you migrate.

Next, I am pretty sure there is a debug setting that logs all the query elements. You can
just enable TRACE on the highest Solr level on the test system and then pick the specific
message you like most. Then, enable that in log4j.config file for your production. That would
be low level reporting, possibly in a format you need to post-process. Depending on where
that debug is coming from, this may or may not include the defaults/overrides.

You could enable echoParams=all or echoParams=explicit, which will then send the request parameters
with the reply in the JSON format. You'd need to extract it from that somehow though. Again,
it would be easy if you had a single contact point in middleware as well.

Finally, you could do a custom search component and - since it has access to the request parameter
map - log it any way you want. Or a custom UpdateRequestProcessor, I think they can access
that info as well.

Or, if you can't touch anything, but your network/cpu is not overloaded, you could run Wireshark
and capture the HTTP requests right off the network traffic. That's bringing gun with a silencer
to a knife fight, but perhaps you would enjoy the bragging rights. Or - more realistically
- perhaps you want to capture POST body content, response timing, encoding abnormalities or
other debug-level issues.

Hope this helps,
   Alex.

----
http://www.solr-start.com/ - Resources for Solr users, new and experienced

On 17 February 2017 at 07:17, Prateek Jain J <prateek.j.jain@ericsson.com>
wrote:

>
>
> Hi All,
>
>
>
> How can I log queries received by solr from applications. By query, I 
> mean full URL with parameters executed by application. For example,
>
>
>
> I expect to see something like this
>
>
>
> http://solr:8389/my_collection?q=*:*&fq=eventRecordTimestamp:[NOW-
> 60000MILLISECONDS TO NOW]
>
>
>
> I tried to enable debug logs for org.apache.solr package (java) and 
> enable all logging levels from solr admin UI (image attached). I am 
> hoping there should be a simple way for achieving this and something 
> silly is what I am missing here.
>
>
>
>
>
>
>
> Regards,
>
> Prateek Jain
>
> Team: Totoro
>
> Mobile: +353 894 391716
>
>
>
Mime
View raw message