Skip to content

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:

  1. Download the latest driver.

  2. 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.

    PresetActionDescription
    DataQueryingLEGACY-ARCHIVE-QUERIES:EXECUTE
    LOGS.DATA-API#HIGH:READDATA
    METRICS.DATA-API#HIGH:READDATA
    SPANS.DATA-API#HIGH:READDATA
    Query Data from the Archive
    Query Frequent Search Logs
    Query Metrics
    Query Frequent Search Spans
  3. Follow the client-specific instructions in the following sections. Other clients have a similar procedure for installing the driver.

  4. Test the connection using a simple query: SELECT * FROM logs LIMIT 5

DataGrip

  1. In the Database menu, select the + icon, then select Driver.

  2. In the Name field, enter Coralogix.

  3. Under Driver Files, select the + icon, then select the driver file you downloaded earlier (Getting started, step 1).

  4. Open the Class picker and select org.opensearch.jdbc.Driver.

  5. Select Apply, then OK.

  6. In the database menu, select the + icon, then select Data Source, then select Coralogix.

  7. Replace <cx_api_key> with the generated API key value in the following JDBC URL, as per your team's cluster location.

  8. In the General tab, 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.

  9. Select Apply, then OK.

DBeaver

  1. In the top menu, select Database, then Driver manager, then select New.

  2. In the Driver Name field, enter Coralogix.

  3. In the Libraries tab, select Add File, then select the driver file you downloaded earlier (Getting started, step 1).

  4. Select Find Class. Select org.opensearch.jdbc.Driver in the Driver Class field.

  5. Select OK.

  6. Select Close.

  7. Select Database/New Database Connection, and make sure you select All.

  8. Type coralogix into the search box and select the Coralogix driver. Select Next.

  9. Replace <cx_api_key> with the generated API key value in the following JDBC URL, as per your Coralogix domain.

  10. Set JDBC URL to 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.

  11. Select Test Connection to ensure it all works.

  12. Select OK.

Tableau

  1. 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
  2. Place the OpenSearch JDBC driver (jar file) downloaded earlier (Getting started, step 1) into:

    • Windows: C:\\Program Files\\Tableau\\Drivers
    • MacOS: ~/Library/Tableau/Drivers
  3. 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.

  4. Replace <cx_api_key> with the generated API key value in the following JDBC URL, as per your team's cluster location.

  5. Open Tableau and select Server, then Coralogix by Coralogix.

  6. Set the JDBC URL to: 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

APIDirect Lucene & DataPrime Query HTTP API
ExternalOpenDistro SQL
Coralogix EndpointsCoralogix Endpoints