Querying Coralogix with SQL
With the Coralogix JDBC driver, you can investigate your log data using SQL queries in your favorite database tool. You can quickly run SQL queries against the data already stored in your Coralogix account.
Java Database Connectivity (JDBC) is a common standard for database drivers, and many popular querying tools support it. This tutorial explains how to use the Coralogix JDBC driver with the popular tools DataGrip, DBeaver, and Tableau.
Note
Use this API to query high-tier data only.
Getting started
Follow these steps to set up the connection to Coralogix:
Download the latest driver.
To use this API you need to create a personal or team API key. Use permission presets when possible, as they update automatically with all relevant permissions. Alternatively, add individual permissions manually.
Preset Action Description DataQuerying LEGACY-ARCHIVE-QUERIES:EXECUTE
LOGS.DATA-API#HIGH:READDATA
METRICS.DATA-API#HIGH:READDATA
SPANS.DATA-API#HIGH:READDATAQuery Data from the Archive
Query Frequent Search Logs
Query Metrics
Query Frequent Search SpansFollow the client-specific instructions in the following sections. Other clients have a similar procedure for installing the driver.
Test the connection using a simple query:
SELECT * FROM logs LIMIT 5
DataGrip
In the Database menu, select the
+icon, then selectDriver.In the
Namefield, enterCoralogix.Under
Driver Files, select the+icon, then select the driver file you downloaded earlier (Getting started, step 1).Open the
Classpicker and selectorg.opensearch.jdbc.Driver.Select
Apply, thenOK.In the database menu, select the
+icon, then selectData Source, then selectCoralogix.Replace
<cx_api_key>with the generated API key value in the following JDBC URL, as per your team's cluster location.In the
Generaltab, change the URL as follows:jdbc:opensearch://https://api./sql/<cx_api_key>. Select the https://api./sql endpoint that corresponds to your Coralogix domain using the domain selector at the top of the page.Select
Apply, thenOK.
DBeaver
In the top menu, select
Database, thenDriver manager, then selectNew.In the
Driver Namefield, enterCoralogix.In the Libraries tab, select
Add File, then select the driver file you downloaded earlier (Getting started, step 1).Select
Find Class. Selectorg.opensearch.jdbc.Driverin theDriver Classfield.Select
OK.Select
Close.Select
Database/New Database Connection, and make sure you select All.Type
coralogixinto the search box and select theCoralogixdriver. SelectNext.Replace
<cx_api_key>with the generated API key value in the following JDBC URL, as per your Coralogix domain.Set
JDBC URLtojdbc:opensearch://https://api./sql/<cx_api_key>. Select the https://api./sql endpoint that corresponds to your Coralogix domain using the domain selector at the top of the page.Select Test Connection to ensure it all works.
Select
OK.
Tableau
Download the cx_sql_jdbc.taco connector file, and copy it to:
- Windows:
C:\\Users\\%USERNAME%\\Documents\\My Tableau Repository\\Connectors - MacOS:
~/Documents/My Tableau Repository/Connectors
- Windows:
Place the OpenSearch JDBC driver (jar file) downloaded earlier (Getting started, step 1) into:
- Windows:
C:\\Program Files\\Tableau\\Drivers - MacOS:
~/Library/Tableau/Drivers
- Windows:
Run the Tableau Desktop with the command line flag
DDisableVerifyConnectorPluginSignature=true:- Windows:
C:\\Program Files\\Tableau\\Tableau 2022.1\\bin\\tableau.exe" -DDisableVerifyConnectorPluginSignature=true - MacOS:
open -n /Applications/Tableau\\ Desktop\\ 2022.1.app --args -DDisableVerifyConnectorPluginSignature=true
Adjust the command line according to the Tableau version you have. You can create a shortcut or a script to simplify this step.
- Windows:
Replace
<cx_api_key>with the generated API key value in the following JDBC URL, as per your team's cluster location.Open Tableau and select Server, then Coralogix by Coralogix.
Set the
JDBC URLto:jdbc:opensearch://https://api./sql/<cx_api_key>. Select the https://api./sql endpoint that corresponds to your Coralogix domain using the domain selector at the top of the page.
Additional resources
| API | Direct Lucene & DataPrime Query HTTP API |
| External | OpenDistro SQL |
| Coralogix Endpoints | Coralogix Endpoints |