Skip to main content
This page documents an earlier version of the API client. For the latest version, see Retrieve log entries.
Required ACL: logs Logs are kept for up to seven days and limited to 1,000 per server. You can’t access logs after the retention period ends. This API method counts towards your operation quota but isn’t logged.

Examples

// Get last 10 log entries
client.GetLogs();

// Asynchronous
await client.GetLogsAsync();

// Get last 100 log entries
client.GetLogs(offset: 0, length: 100);

// Asynchronous
await client.GetLogsAsync(offset: 0, length: 100);

Parameters

length
integer
default:10
The maximum number of entries to retrieve starting at the offset. Maximum allowed value: 1,000.
offset
integer
default:0
Specify the first entry to retrieve (with 0 being the most recent log entry). The maximum offset is the total number of stored logs (which can be lower than the maximum of 1,000).
requestOptions
object
A mapping of request options to send along with the request.
type
enum<string>
Type of logs to retrieve. One of:
  • all: Retrieve all the logs.
  • query: Retrieve only the queries.
  • build: Retrieve only the build operations.
  • error: Retrieve only the errors.

Response

answer
string
Answer body. It’s truncated after 1000 characters.
answer_code
string
HTTP response code.
exhaustive
boolean
Exhaustive flags used during the query.
index
string
Index name of the log.
inner_queries
object[]
Contains an object for each performed query with the indexName, queryID, offset, and userToken.
ip
string
Client ip of the call.
method
string
Rest type of the method.
nb_api_calls
string
Number of API calls.
processing_time_ms
string
Processing time for the query. This does not include network time.
query_body
string
Request body. It’s truncated after 1000 characters.
query_headers
string
Request Headers (API Key is obfuscated).
query_nb_hits
string
Number of hits returned for the query.
sha1
string
SHA1 ID of entry.
timestamp
string
Timestamp in ISO-8601 format.
url
string
Request URL.

Response as JSON

This section shows the JSON response returned by the API. Each API client wraps this response in language-specific objects, so the structure may vary. To view the response, use the getLogs method. Don’t rely on the order of properties—JSON objects don’t preserve key order.
JSON
{
  "logs":[
      {
        "timestamp":"2017-12-29T18:15:57Z",
        "method":"POST",
        "answer_code":"200",
        "query_body":"\n{\n \"requests\": [\n  {\n   \"indexName\": \"best_buy\",\n   \"params\": \"query=&hitsPerPage=10&page=0&attributesToRetrieve=*&highlightPreTag=%3Cais-highlight-0000000000%3E&highlightPostTag=%3C%2Fais-highlight-0000000000%3E&getRankingInfo=1&facets=%5B%22brand%22%2C%22categories%22%2C%22free_shipping%22%2C%22type%22%5D&tagFilters=\"\n  }\n ]\n}\n",
        "answer":"\n{\n \"results\": [\n  {\n   \"hits\": [\n    {\n     \"name\": \"Amazon - Fire TV Stick\",\n     \"description\": \"Amazon Fire TV Stick connects to your TV's HDMI port. Just grab and go to enjoy Netflix, Prime Instant Video, Hulu Plus, YouTube.com, music, and much more.\",\n     \"brand\": \"Amazon\",\n     \"categories\": [\n      \"TV & Home Theater\",\n      \"Streaming Media Players\"\n     ],\n     \"hierarchicalCategories\": {\n      \"lvl0\": \"TV & Home Theater\",\n      \"lvl1\": \"TV & Home Theater > Streaming Media Players\"\n     },\n     \"type\": \"Streaming media plyr\",\n     \"price\": 39.99,\n     \"price_range\": \"1 - 50\",\n     \"image\": \"https:\/\/cdn-demo.algolia.com\/bestbuy\/9999119_sb.jpg\",\n     \"url\": \"http:\/\/www.bestbuy.com\/site\/amazon-fire-tv-stick\/9999119.p?id=1219460752591&skuId=9999119&cmp=RMX&ky=1uWSHMdQqBeVJB9cXgEke60s5EjfS6M1W\",\n     \"free_shipping\": false,\n     \"popularity\": 9843,\n     \"rating\": 4,\n     \"objectID\": \"9999119\"\n",
        "url":"\/1\/indexes\/*\/queries?x-algolia-agent=Algolia%20for%20vanilla%20JavaScript%203.24.7%3BAlgolia%20Dashboard%201.0.0%3Breact-instantsearch%204.1.3%3BJS%20Helper%202.23.0&x-algolia-application-id=AJ0P3S7DWQ&x-algolia-api-key=ce11****************************",
        "ip":"84.14.205.82",
        "query_headers":"Host: c1-de-3.algolianet.com\nConnection: keep-alive\nContent-Length: 308\naccept: application\/json\nOrigin: https:\/\/www.algolia.com\nUser-Agent: Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/63.0.3239.84 Safari\/537.36\ncontent-type: application\/x-www-form-urlencoded\nReferer: https:\/\/www.algolia.com\/apps\/AJ0P3S7DWQ\/explorer\/browse\/best_buy\nAccept-Encoding: gzip, deflate, br\nAccept-Language: fr,en;q=0.9\n",
        "sha1":"44c168cea54d2deca9a4724559cf15eccf15cf3e",
        "nb_api_calls":"1",
        "processing_time_ms":"1",
        "query_nb_hits":"10500",
        "index":"demo_index",
        "inner_queries":[
            {
              "indexName":"best_buy",
              "queryID":313453231,
              "offset":0,
              "userToken":"user_1"
            }
        ]
      }
  ]
}
I