Configure your [hosted Grafana](https://coralogix.com/docs/user-guides/visualizations/hosted-grafana-view/index.md) installation to interface with Coralogix data.

## Overview

Visualize your logs and metrics with familiar functions while accessing all Coralogix data sources automatically and without needing plugins (**recommended**).

For those wishing to use the Grafana plugin, this tutorial demonstrates how to connect and view your logs and metrics in your Coralogix dashboard using **Grafana version 7+**.

## Connect your logs

1.

Navigate to **Home** > **Connection** > **Data sources** > **Add data source**

2.

Select OpenSearch as your data source.

3.

Input the following fields:

- **Name**. Select a name for your data source.

- **URL**. Choose the https://api.\[[DOMAIN_VALUE]\]/data/os-api endpoint that corresponds to your Coralogix [domain](https://coralogix.com/docs/user-guides/account-management/account-settings/coralogix-domain/index.md) using the domain selector at the top of the page.

- **Skip TLS certification verification**. Check to activate.

- **HTTP headers**:

  - Header: `Authorization`

  - Value: `Bearer <cx_api_key>`\
    To use this API you need to [create](https://coralogix.com/docs/user-guides/account-management/api-keys/api-keys/index.md) a personal or team API key. It’s recommended to use permission presets, as they are automatically updated with all relevant permissions. Alternatively, you can manually add individual permissions.

    | Preset       | Action                                                                                                                                                                                    | Description                                                                                                                                                             |
    | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | DataQuerying | `LEGACY-ARCHIVE-QUERIES:EXECUTE` `LOGS.DATA-API#HIGH:READDATA` `LOGS.DATA-API#LOW:READDATA` `METRICS.DATA-API#HIGH:READDATA` `SPANS.DATA-API#HIGH:READDATA` `SPANS.DATA-API#LOW:READDATA` | Query Data from the Archive Query Frequent Search Logs Query Monitoring & Compliance Logs Query Metrics Query Frequent Search Spans Query Monitoring & Compliance Spans |

- **Index name:** `*`

- **Pattern:** `No pattern`

- **Time field name**: `coralogix.timestamp`

4.

Click **Save & test**.

A popup message will inform you if you have configured your data source successfully.

## Connect your metrics

As part of Coralogix’s metrics offering, we support querying metric data through the most prevalent time-series query language: PromQL. This allows you to use Coralogix as your metrics backend, add it as a Prometheus data source to your Grafana instance, and update existing dashboards without changing the queries or syntax.

[Configure a Prometheus data source](https://grafana.com/docs/grafana/latest/datasources/prometheus/) in Grafana:

1.

Navigate to **Home** > **Connection** > **Add new connection**. Enter **Prometheus data source**.

2.

Click **Add new data source**.

3.

Input the following fields:

**Connection**

- Prometheus server URL: Choose the https://api.\[[DOMAIN_VALUE]\]/metrics endpoint that corresponds to your Coralogix [domain](https://coralogix.com/docs/user-guides/account-management/account-settings/coralogix-domain/index.md) using the domain selector at the top of the page.

**Authentication**

- **HTTP headers**:
  - Header: `Authorization`
  - Value: `Bearer <cx_api_key>` (as mentioned in the **Authentication** section above)

**Advanced Settings**

- **Performance**
  - Prometheus type: `Prometheus`
  - Prometheus version: `2.24.x`

4.

Click **Save & test**. You should receive a message confirming a successful query to the Prometheus API.

Find out more [here](https://grafana.com/docs/grafana/latest/datasources/prometheus/).

## Useful Docker commands

If you have Grafana installed on a Docker container, use these useful commands to interact with Grafana:

- List all docker containers

```bash
docker ps -a
```

- Log in to your Grafana container

```bash
sudo docker exec -it "Grafana container ID" /bin/bash
```

- Restart Grafana

```bash
docker restart "Grafana container ID"
```

## Additional resources

|                     |                                                                                             |
| ------------------- | ------------------------------------------------------------------------------------------- |
| Coralogix Endpoints | [Coralogix Endpoints](https://coralogix.com/docs/integrations/coralogix-endpoints/index.md) |

## Support

**Need help?**

Our world-class customer success team is available 24/7 to walk you through your setup and answer any questions that may come up.

Feel free to contact us **via our in-app chat** or by emailing [support@coralogix.com](mailto:support@coralogix.com).
