Quantcast

logging query received

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

logging query received

Prateek Jain J

 

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

 

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: logging query received

alessandro.benedetti
If you enabled the logging for org.apache.solr.core you should be fine.
You can also go more fine grained if you don't need part of the logs.
Just remember that the UI will show only from the warning level.
If you want to see the query log you need to access the log files.

N.B. in a produciton environment I would not recommend to log at Info level all the queries received.
It will affect the performances.
I would suggest to log only the slow queries.

[1] https://cwiki.apache.org/confluence/display/solr/Configuring+Logging

Cheers
---------------
Alessandro Benedetti
Search Consultant, R&D Software Engineer, Director
Sease Ltd. - www.sease.io
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: logging query received

Alexandre Rafalovitch
In reply to this post by Prateek Jain J
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 <[hidden email]>
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
>
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: logging query received

Prateek Jain J

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:[hidden email]]
Sent: 17 February 2017 02:33 PM
To: solr-user <[hidden email]>
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 <[hidden email]>
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
>
>
>
Loading...