Hi again.
I want to display the Activity Monitor out of the backend in my frontend Website (Queries per second) and the most popular queries.
So can somebody tell me how to do this.
Tags:
No tags yet.
NewRelic (http://newrelic.com/) is an online service that monitors your Solr instance and gives graphs for queries-per-second. For "most popular queries", you need to query the LucidWorksLogs collection.
u23297
Member
Hmm ok, but how can i querying that collection.
Querying other collections is done like this:
"http://server:port/solr/collection/lucid?q=test&wt=phps&role=DEFAULT&rows=100"
To querying the collection LucidWorksLogs i need a word "q=....."
About new relic:
This app sounds good but do you know an application runs in intranet (offline).
tomas.lobbe
Moderator
You can query the LucidWorksLogs collection as a regular collection, by adding the name to the URL:
http://host:port/solr/LucidWorksLogs/select/?q=....
For example, you could see the most common queries for the last week with a query like:
http://host:port/solr/LucidWorksLogs/select/?q=*:*&fq=lastModified:[NOW/DAY-7DAY%20TO%20*]&fq=core:[yourcollection]&facet=true&facet.field=attr_q&rows=0
I don't think newreilc can run offline, but you could use any monitoring tool. See http://www.lucidimagination.com/blog/2011/10/02/monitoring-apache-solr-and-lucidworks-with-zabbix/
u23297
Member
Ok i have it. But there is a new problem.
When i start searching an object in the backend of LWE, it gets LucidWorksLogs get some information about most search words and so on. But if im searching in my frontend (api), no information (about most querying words for example) will send to this collection.
So i can querying the LucidWorksLogs Collection but the activities where not registred.
About Monitoring:
I see that we uses piwik as an analytics tool. Isnt it possible to handle the problem with piwik? Is someone useing it allready?
Thanks.
tomas.lobbe
Moderator
You are saying that if you search with your application then you don't see the requests in the LucidWorksLogs collection? you should. This collection collects lines from Solr's log, so it really doesn't matter where the queries come from, all should be indexed into this collection.
hossman1
Moderator
So i can querying the LucidWorksLogs Collection but the activities where not registred.
There is a small note about this on the page with info on building clients that talk directly to Solr...
http://lucidworks.lucidimagination.com/display/lweug/Solr+Direct+Access
"To ensure that your query is indexed for UI reporting, include the <tt>req_type=main</tt> parameter in your query URL."
In short: the LucidWorksLogs crawler only indexes requets containing <tt>req_type=main</tt> to ensure that things like autocomplete requests, or monitoring requests that you don't want tracked (ie: queries to the LucideWorksLogs collection itself), aren't recorded and don't throw off the statistics
u23297
Member
OK one final question :D
In backend the most popular queries were counted by lucid and shown in brackets as u now.
So is it possible to get these information? So if im querying my LucidWorksLogs i get the following array:
Array([response]=>......[facet_fields] => Array([attr_q] => Array([qms] => 0 [ISO] => 0 ...)))
As u can see there are only zeros.
u23297
Member
<?php
$url="http://qms:8888/solr/LucidWorksLogs/select/?q=*:*&wt=phps&fq=lastModified:[NOW%20TO%20*]&debugQuery=on&fq=core:alles_1&facet=on&facet.field=attr_q&rows=0";
$serializedResult=file_get_contents($url);
$response=unserialize($serializedResult);
$a = $response['facet_counts']['facet_fields']['attr_q'];
print_r($response); // check if result is given
echo "<hr>"; //
foreach ($a as $k => $v){
echo "$k => $v
";}
?>
lastModified:[NOW TO *] is likely not finding anything which explains the 0's. Try what Tomas mentioned above: lastModified:[NOW/DAY-7DAY TO *] (and of course URL encode where appropriate).
Do a search in the LucidWorksLogs search ui. Are there any records during this time period? Or any records at all?
Also, you have to say "&facet=true" in the query string.
u23297
Member
Hi again. @Lance: Yes i have! In Backend of LWE there is a record, but not in my frontend! The searched query was posted but the faced counts is zero.
$url="http://".$search_server_name.":".$search_server_port."/solr/LucidWorksLogs/select/?q=*:*&wt=phps&fq=lastModified:[NOW/DAY-7DAY%20TO%20*]&debugQuery=on&fq=core:alles_1&facet=true&facet.field=attr_q&rows=0";
$serializedResult=file_get_contents($url);
$response=unserialize($serializedResult);
$a = $response['facet_counts']['facet_fields']['attr_q'];
foreach ($a as $k => $v){
echo utf8_decode($k)." (".$v.")";
}
Output (after i had searched "QMS"): QMS (0)
u23297
Member
OK i've seen my fault!
I had added a second "&fq=...." so my actual string is the following:
$url="http://".$search_server_name.":".$search_server_port."/solr/LucidWorksLogs/select/?q=*:*&wt=phps&fq=lastModified:[NOW/DAY-7DAY%20TO%20*]&debugQuery=on&facet=true&facet.field=attr_q&rows=0";