Re: Logging which client connected to Solr

2014-03-27 Thread Greg Walters
We do something similar and include the server's hostname in solr's response. 
To accomplish this you'll have to write a class that extends 
org.apache.solr.servlet.SolrDispatchFilter and put your custom class in place 
as the SolrRequestFilter in solr's web.xml.

Thanks,
Greg

On Mar 27, 2014, at 8:59 AM, Juha Haaga juha.ha...@codenomicon.com wrote:

 Hello,
 
 I’m investigating the possibility of logging the username of the client who 
 did the search on Solr along with the normal logging information. The 
 username is in the basic auth headers of the request, and the access control 
 is managed by an Apache instance proxying to Solr. Is there a way to append 
 that information to the Solr query log, so that the log would look like this:
 
 INFO  - 2014-03-27 11:16:24.000; org.apache.solr.core.SolrCore; [generic] 
 webapp=/solr path=/select params={lots of params} hits=0 status=0 QTime=49 
 username=juha
 
 I need to log both username and the query, and if I do it directly in Apache 
 then I lose the information about amount of hits and the query time. If I log 
 it with Solr then I get query time and hits, but no username. Username 
 logging is higher priority requirement than the hits and query time, but I’m 
 looking for solution that covers both cases. 
 
 Has anyone implemented this kind of logging scheme, and how would I 
 accomplish this? I couldn’t find this as a configuration option.
 
 Regards,
 Juha
 
 
 
 
 



Re: Logging which client connected to Solr

2014-03-27 Thread Jeff Wartes

You could always just pass the username as part of the GET params for the
query. Solr will faithfully ignore and log any parameters it doesn¹t
recognize, so it¹d show up in your {lot of params}.

That means your log parser would need more intelligence, and your client
would have to pass in the data, but it would save any custom work on the
server side.



On 3/27/14, 7:07 AM, Greg Walters greg.walt...@answers.com wrote:

We do something similar and include the server's hostname in solr's
response. To accomplish this you'll have to write a class that extends
org.apache.solr.servlet.SolrDispatchFilter and put your custom class in
place as the SolrRequestFilter in solr's web.xml.

Thanks,
Greg

On Mar 27, 2014, at 8:59 AM, Juha Haaga juha.ha...@codenomicon.com
wrote:

 Hello,
 
 I¹m investigating the possibility of logging the username of the client
who did the search on Solr along with the normal logging information.
The username is in the basic auth headers of the request, and the access
control is managed by an Apache instance proxying to Solr. Is there a
way to append that information to the Solr query log, so that the log
would look like this:
 
 INFO  - 2014-03-27 11:16:24.000; org.apache.solr.core.SolrCore;
[generic] webapp=/solr path=/select params={lots of params} hits=0
status=0 QTime=49 username=juha
 
 I need to log both username and the query, and if I do it directly in
Apache then I lose the information about amount of hits and the query
time. If I log it with Solr then I get query time and hits, but no
username. Username logging is higher priority requirement than the hits
and query time, but I¹m looking for solution that covers both cases.
 
 Has anyone implemented this kind of logging scheme, and how would I
accomplish this? I couldn¹t find this as a configuration option.
 
 Regards,
 Juha
 
 
 
 
 




Re: Logging which client connected to Solr

2014-03-27 Thread Alexandre Rafalovitch
I assume you are passing extra info to Solr.

Then you can write servletfilter to put it in NDC or MDC which can then be
picked up by log4j config pattern.

This approach is not Solr specific. Just usual servlet/log stuff.

Regards,
 Alex
On 27/03/2014 9:00 pm, Juha Haaga juha.ha...@codenomicon.com wrote:

 Hello,

 I’m investigating the possibility of logging the username of the client
 who did the search on Solr along with the normal logging information. The
 username is in the basic auth headers of the request, and the access
 control is managed by an Apache instance proxying to Solr. Is there a way
 to append that information to the Solr query log, so that the log would
 look like this:

 INFO  - 2014-03-27 11:16:24.000; org.apache.solr.core.SolrCore; [generic]
 webapp=/solr path=/select params={lots of params} hits=0 status=0 QTime=49
 username=juha

 I need to log both username and the query, and if I do it directly in
 Apache then I lose the information about amount of hits and the query time.
 If I log it with Solr then I get query time and hits, but no username.
 Username logging is higher priority requirement than the hits and query
 time, but I’m looking for solution that covers both cases.

 Has anyone implemented this kind of logging scheme, and how would I
 accomplish this? I couldn’t find this as a configuration option.

 Regards,
 Juha