Documentation

Select a category on the left, to get your answers quickly

Solr Traffic Monitoring API

With Opensolr, you can now use the Automation REST API, in order to find anomalies and audit your Solr requests, in many fun ways.
Here are some example API requests that you can make to get all requests in a csv format, JSON format for all requests, etc (you can use the start and rows parameter to paginate the requests, and grab all data through multiple requests, programmatically):

Using curl (simply login and then copy/paste any of these):

All requests from 1 day ago as csv (might take a while to load):

curl -gs "https://opensolr.com/solr_manager/api/request_log?email=PLEASE_LOG_IN&api_key=PLEASE_LOG_IN&core_name=PLEASE_LOG_IN&start=0&sort=date%20desc&rows=20000000&fq[]=date:[NOW-1DAY%20TO%20NOW]&wt=csv"


IP and Path facets on all requests since 1 Month ago:

curl -gs "https://opensolr.com/solr_manager/api/request_log?email=PLEASE_LOG_IN&api_key=PLEASE_LOG_IN&core_name=PLEASE_LOG_IN&start=0&sort=date%20desc&rows=0&fq[]=date:[NOW-1MONTH%20TO%20NOW]&wt=json&facet=true&facet.field[]=path&facet.field[]=ip"


Popular search queries Today:

curl -gs "https://opensolr.com/solr_manager/api/request_log?email=PLEASE_LOG_IN&api_key=PLEASE_LOG_IN&core_name=PLEASE_LOG_IN&start=0&sort=date%20desc&rows=0&fq[]=date:[NOW-1DAY%20TO%20NOW]&wt=json&facet=true&facet.field[]=q"


Today's http status code for all requests:

curl -gs "https://opensolr.com/solr_manager/api/request_log?email=PLEASE_LOG_IN&api_key=PLEASE_LOG_IN&core_name=PLEASE_LOG_IN&start=0&sort=date%20desc&rows=0&fq[]=date:[NOW-1DAY%20TO%20NOW]&wt=json&facet=true&facet.field[]=http_status"


Today's requests that have failed with 4xx error codes:
Get 20 requests per page:

curl -gs "https://opensolr.com/solr_manager/api/request_log?email=PLEASE_LOG_IN&api_key=PLEASE_LOG_IN&core_name=PLEASE_LOG_IN&start=0&sort=date%20desc&rows=20&fq[]=date:[NOW-1DAY%20TO%20NOW]&fq[]=+http_status:4*&wt=json"


Get all requests as csv (may take a long time to load):

curl -gs "https://opensolr.com/solr_manager/api/request_log?email=PLEASE_LOG_IN&api_key=PLEASE_LOG_IN&core_name=PLEASE_LOG_IN&start=0&sort=date%20desc&rows=200000&fq[]=date:[NOW-1DAY%20TO%20NOW]&fq[]=+http_status:4*&wt=json"

Get the Solr index error log

  1. GET https://opensolr.com/solr_manager/api/get_error_log
  2. Parameters:
    1. ​email - your opensolr registration email address
    2. api_key - your opensolr api_key
    3. core_name - the name of the core you wish to get the error log for
  3. Example: https://opensolr.com/solr_manager/api/get_error_log?email=PLEASE_LOG_IN&
    api_key=PLEASE_LOG_IN&core_name=my_solr_core

Get Index Request Log

You can use this method, to get your request log, in a SOLR JSON format.
You can add almost every solr-supported parameter to your GET request, as GET parameters, as explained in the example below, where we get the first 10 request log entries for the index named opensolr between dates: Jan. 01 2023 to May 01 2023, where the requests returned an error http_status (-fq=http_status:200) sorted by date descending.

  1. GET https://opensolr.com/solr_manager/api/request_log
  2. Parameters:
    1. ​email - your opensolr registration email address
    2. api_key - your opensolr api_key
    3. ​core_name - the name of the index
    4. most other solr-supported query parameter, such as: q, start, rows, sort, fq, facet, facet.field[] etc
    5. Click here to learn more about the supported Solr Query Parameters
    6. Note that the multiple solr-supported parameters, will be passed with a double square bracket [], to indicate an array of multiple values for the same parameter, such in the case of fq, qf, etc.
    7. For example, if you want to enable facetting, you'll have to pass on the parameters like:  &facet=true&facet.field[]=ip&facet.field[]=core_name
    8. To exclude empty queries: &fq[]=-q:""
    9. To exclude empty and wildcard queries: &fq[]=-q:""&fq[]=-q:"*:*"
    10. To get data in another format, you simply pass in a different wt parameter, as such: &wt=csv which gets data in csv format. You can get more information here.
    11. By making a sample request you will see all the fields that are available to filter, sort or facet by.
  3. Example request: 
    https://opensolr.com/solr_manager/api/request_log?email=PLEASE_LOG_IN&api_key=PLEASE_LOG_IN&core_name=opensolr&start=0&sort=date%20desc&rows=10&fq[]=date:[2023-01-01T00:00:00Z%20TO%202023-05-31T00:00:00Z]&facet=true&facet.field[]=core_name&fq[]=+http_status:""&fq[]=-http_status:200

     





Review us on Google Business
Close Check out the Fully Automated Solr server setup for Drupal & WordPress.