Table: algolia_log - Query Algolia Logs using SQL
Algolia is a powerful search-as-a-service solution, making it easy to build and optimize search experiences. It offers robust APIs and extensive documentation to customize the platform to specific needs. Algolia logs provide crucial insights into the operations and events occurring within the platform.
Table Usage Guide
The algolia_log
table provides insights into the logs within Algolia. As a developer or system administrator, explore log-specific details through this table, including the type of events, timestamps, and associated metadata. Utilize it to uncover information about operations, such as search queries, indexing operations, and API calls, providing a clear overview of activities within the Algolia platform.
Examples
List all log entries
Explore your entire log history in chronological order, giving you the ability to track changes, spot trends and identify potential issues over time. This is particularly useful for auditing, debugging, and maintaining the overall health of your system.
select *from algolia_logorder by timestamp desc;
select *from algolia_logorder by timestamp desc;
List errors from the log
Identify instances where requests to Algolia have resulted in errors. This can be used to pinpoint specific issues and improve the overall performance of your application.
select *from algolia_logwhere answer_code != 200order by timestamp desc;
select *from algolia_logwhere answer_code != 200order by timestamp desc;
Find slow queries (>5ms) in the last 24 hours
Explore which queries have been performing slowly, taking more than 5 milliseconds, in the last 24 hours. This can be useful for identifying potential bottlenecks and improving overall system performance.
select *from algolia_logwhere processing_time_ms > 5 and age(timestamp) < interval '24 hours'order by timestamp desc;
select *from algolia_logwhere processing_time_ms > 5 and julianday('now') - julianday(timestamp) < 1order by timestamp desc;
Log entries by user agent
Explore the frequency of different user agents accessing your system to identify trends or anomalies. This can assist in understanding user behaviors, detecting potential security risks, and optimizing system performance.
select query_headers ->> 'User-Agent' as user_agent, count(*)from algolia_loggroup by user_agentorder by count desc;
select json_extract(query_headers, '$."User-Agent"') as user_agent, count(*)from algolia_loggroup by user_agentorder by count(*) desc;
Schema for algolia_log
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
answer | text | Answer body, truncated after 1000 characters. JSON format, but returned as a string due to the truncation. | |
answer_code | bigint | Code of the answer. | |
app_id | text | =, !=, ~~, ~~*, !~~, !~~* | Unique identifier for the algolia application. |
exhaustive | boolean | Exhaustive flags used during the query. | |
index | text | Index the query was executed against, or null for metadata queries. | |
inner_queries | jsonb | Contains an object for each performed query with the indexName, queryID, offset, and userToken. | |
ip | inet | IP address of the request client. | |
method | text | HTTP method used for the query, e.g. GET, POST. | |
number_api_calls | bigint | Number of API calls. | |
processing_time_ms | bigint | Processing time for the request in milliseconds. | |
query_body | text | Request body, truncated after 1000 characters. | |
query_headers | jsonb | HTTP headers for the query. | |
query_number_hits | bigint | Number of hits returned for the query. | |
sha1 | text | SHA1 ID of the log entry. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
timestamp | timestamp with time zone | Time when the log entry was created. | |
url | text | URL of the query request. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- algolia
You can pass the configuration to the command with the --config
argument:
steampipe_export_algolia --config '<your_config>' algolia_log