Required API Key: any key with the logs ACL
Method signature
$client->getLogs()
$client->getLogs(offset, length)
$client->getLogs(offset, length, type)
Method signature
client.get_logs()
client.get_logs(offset, length)
client.get_logs(offset, length, type)
Method signature
client.getLogs({
  offset: offset,
  length: length,
  type: type
}, callback);

Method signature
client.get_logs()
client.get_logs(offset, length)
client.get_logs(offset, length, type)
Method signature
This method is not available in mobile API clients.

Logs are available in the Algolia Dashboard
or with our backend API clients.

Method signature
This method is not available in mobile API clients.

Logs are available in the Algolia Dashboard
or in our backend API clients.

Method signature
client.GetLogs()
client.GetLogs(offset, length)
Method signature
client.getLogs()
client.getLogs(offset, length, type)
Method signature
client.GetLogs(algoliasearch.Map{
  "offset": offset,
  "length": length,
  "type": type
})

Method signature
getLogs
getLogs offset offset length length `type`
getLogs offset offset length length `type` type

About this method

Get the logs of the latest search and indexing operations.

You can retrieve the logs of your last 1,000 API calls. It is designed for immediate, real-time debugging.

All logs older than 7 days will be removed and won’t be accessible anymore from the API.

This API is counted in your operation quota but is not logged.

Examples

<?php
// Get last 10 log entries
$res = $client->getLogs();

// Get last 100 log entries
$res = $client->getLogs(0, 100);
# Get last 10 log entries
puts client.get_logs
# Get last 100 log entries
puts client.get_logs(0, 100)
# Get last 100 errors
puts client.get_logs(0, 100, 'query')
client.getLogs({
  offset: 100, // where to start from, default to 0
  length: 100, // how much lines do you want, default to 10
  type: 'error' // which logs do you want, default to no value (all)
}, function(err, content) {
  console.log(content);
});
# Get last 10 log entries
print client.get_logs()
# Get last 100 log entries
print client.get_logs(0, 100)
// Not implemented in the swift API client
// Get last 10 log entries

client.GetLogs();

// Asynchronous
// await client.GetLogsAsync();
// Get last 100 log entries

int offset = 0;
int length = 100;
client.GetLogs(offset, length);

// Asynchronous
// await client.GetLogsAsync(0, 100);
// Sync & Async version

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

// Get last 100 log entries, of type build
client.getLogs(0, 100, LogType.LOG_BUILD);
// Gets last 10 log entries
params := algoliasearch.Map{
  "offset": 0,
  "length": 10,
  "type":   "query",
}
res, err := client.GetLogs(params)

// Gets last 100 log entries
params["length"] = 100
res, err = client.GetLogs(params)

// Gets last 100 log errors
params["type"] = "error"
res, err = client.GetLogs(params)
// Get last 10 log entries
client.execute {
   getLogs
}

// Get last 100 log entries
client.execute {
   getLogs length 100
}

Parameters

offset
type: integer
Optional
default: 0

Specify the first entry to retrieve (0-based, 0 is the most recent log entry).

length
type: integer
Optional
default: 10

Specify the maximum number of entries to retrieve starting at the offset. Maximum allowed value: 1,000.

type
type: string|enum
Optional

Type of logs to retrieve. Can be one of the following:

  • query: Retrieve only the queries.
  • build: Retrieve only the build operations.
  • error: Retrieve only the errors.

Response

In this section we document the JSON response returned by the API. Each language will encapsulate this response inside objects specific to the language and/or the implementation. So the actual type in your language might differ from what is documented.

JSON format

{
    "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"
        }
    ]
}

log object
timestamp
string

Timestamp in ISO-8601 format.

method
string

Rest type of the method.

answer_code
string

Http response code.

query_body
string

Request body. It’s truncated after 1000 characters.

answer
string

Answer body. It’s truncated after 1000 characters.

url
string

Request URL.

ip
string

Client ip of the call.

query_headers
string

Request Headers (API Key is obfuscated).

sha1
string

SHA1 ID of entry.

nb_api_calls
string

Number of API calls.

processing_time_ms
string

Processing time for the query. This does not include network time.

query_nb_hits
string

Number of hits returned for the query.

exhaustive
boolean

Exhaustive flags used during the query.

index
string

Index name of the log.

Php small white
PHP
Ruby small white
Ruby
Javascript small white
JavaScript
Python small white
Python
Swift small white
iOS
Android small white
Android
Csharp small white
C#
Java small white
Java
Go small white
Go
Scala small white
Scala
Php small white
PHP
Ruby small white
Ruby
Javascript small white
JavaScript
Python small white
Python
Swift small white
iOS
Android small white
Android
Csharp small white
C#
Java small white
Java
Go small white
Go
Scala small white
Scala