# Public Cloud › Analytics › OpenSearch › Observability API

> Part of the OVHcloud developer hub. Index of every page and section: https://developers.eu.ovhcloud.com/llms.txt
> The Public Cloud product's sections: https://developers.eu.ovhcloud.com/reference/public-cloud/llms.txt
> Everything in one file: https://developers.eu.ovhcloud.com/llms-full.txt

> 11 operations of the OVHcloud API. Calls carry `authorization: Bearer $OVH_TOKEN`; the EU host is shown, Canada and the United States answer on api.ca.ovhcloud.com and api.us.ovhcloud.com.

Page: https://developers.eu.ovhcloud.com/reference/public-cloud/analytics/opensearch/observability/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/public-cloud/analytics/opensearch/observability.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/public-cloud/analytics/opensearch/observability.json?format=openapi3

## Operations

- `GET /publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/kind` — List log kinds
- `GET /publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/subscription` — List log subscriptions
- `GET /publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/metric` — List metrics
- `GET /publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/kind/{name}` — Get a log kind
- `GET /publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/subscription/{subscriptionId}` — Get a log subscription
- `GET /publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/metric/{metricName}` — Get a metric
- `GET /publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/prometheus` — Get the Prometheus endpoint
- `POST /publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/subscription` — Create a log subscription
- `POST /publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/url` — Generate a temporary log URL
- `POST /publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/prometheus/credentials/reset` — Reset the Prometheus credentials
- `DELETE /publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/subscription/{subscriptionId}` — Delete a log subscription

## List log kinds

`GET /v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/kind`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/analytics/opensearch/observability/#get-publiccloud-project-projectid-managedanalytics-opensearch-serviceid-log-kind

**Status:** Beta version  
**IAM actions:** `publicCloudProject:apiovh:analytics/opensearch/log/kind/get`

Returns the names of the log kinds OpenSearch emits, which can be forwarded to a stream.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-Pagination-Cursor` | header | string |  | Pagination cursor |
| `X-Pagination-Size` | header | integer |  | Pagination size |
| `projectId` | path | string | yes | Project ID |
| `serviceId` | path | string (uuid) | yes | Service ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | string[] | successful operation |

```json
[
  "string"
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/kind" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/kind")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/kind");

print_r($result);
?>
```

## List log subscriptions

`GET /v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/subscription`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/analytics/opensearch/observability/#get-publiccloud-project-projectid-managedanalytics-opensearch-serviceid-log-subscription

**Status:** Beta version  
**IAM actions:** `publicCloudProject:apiovh:analytics/opensearch/log/subscription/get`

Returns the identifiers of the OpenSearch log subscriptions. Set `kind` to restrict the list to one log kind.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-Pagination-Cursor` | header | string |  | Pagination cursor |
| `X-Pagination-Size` | header | integer |  | Pagination size |
| `kind` | query | publicCloud.database.KindEnum |  | Filter subscriptions by log kind — one of `CUSTOMER_LOGS` |
| `projectId` | path | string | yes | Project ID |
| `serviceId` | path | string (uuid) | yes | Service ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | string (uuid)[] | successful operation |

```json
[
  "00000000-0000-0000-0000-000000000000"
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/subscription" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/subscription")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/subscription");

print_r($result);
?>
```

## List metrics

`GET /v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/metric`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/analytics/opensearch/observability/#get-publiccloud-project-projectid-managedanalytics-opensearch-serviceid-metric

**Status:** Beta version  
**IAM actions:** `publicCloudProject:apiovh:analytics/opensearch/metric/get`

Returns the metrics available for the service. Set extended to true to include engine-specific metrics.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-Pagination-Cursor` | header | string |  | Pagination cursor |
| `X-Pagination-Size` | header | integer |  | Pagination size |
| `extended` | query | boolean |  | Display engine-specific metrics |
| `projectId` | path | string | yes | Project ID |
| `serviceId` | path | string (uuid) | yes | Service ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.database.Metric[] | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `metrics` | publicCloud.database.HostMetric[] | read-only | Metric values for each host in the cluster |
| `metrics[].dataPoints` | publicCloud.database.DataPoint[] | read-only | List of metric samples |
| `metrics[].dataPoints[].timestamp` | integer | read-only | Timestamp in seconds since epoch |
| `metrics[].dataPoints[].value` | number | read-only | Value of the data point |
| `metrics[].hostname` | string | read-only | Name of the originating host |
| `name` | string | read-only | Name of the metric |
| `unit` | publicCloud.database.MetricUnitEnum | read-only | Unit of the metric values — one of `BYTES`, `BYTES_PER_SECOND`, `GIGABYTES`, `GIGABYTES_PER_HOUR`, `MEGABYTES`, `MEGABYTES_PER_SECOND`, `MILLISECONDS`, `PERCENT`, `SCALAR`, `SCALAR_PER_SECOND`, `SECONDS`, `UNKNOWN` |

```json
[
  {
    "metrics": [
      {
        "dataPoints": [
          {
            "timestamp": 0,
            "value": 0
          }
        ],
        "hostname": "string"
      }
    ],
    "name": "string",
    "unit": "BYTES"
  }
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/metric" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/metric")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/metric");

print_r($result);
?>
```

## Get a log kind

`GET /v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/kind/{name}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/analytics/opensearch/observability/#get-publiccloud-project-projectid-managedanalytics-opensearch-serviceid-log-kind-name

**Status:** Beta version  
**IAM actions:** `publicCloudProject:apiovh:analytics/opensearch/log/kind/get`

Returns a log kind and the additional fields its logs carry.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `name` | path | string | yes | Name |
| `projectId` | path | string | yes | Project ID |
| `serviceId` | path | string (uuid) | yes | Service ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | dbaas.logs.LogKind | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `additionalReturnedFields` | string[] | read-only | List of additional log fields managed in this log kind |
| `createdAt` | string (date-time) | read-only | Creation date of the log kind |
| `displayName` | string | read-only | Log kind display name |
| `kindId` | string (uuid) | read-only | Identifier of the log kind |
| `name` | string | read-only | Log kind name |
| `updatedAt` | string (date-time) | read-only | Last update date of the log kind |

```json
{
  "additionalReturnedFields": [
    "string"
  ],
  "createdAt": "2024-01-01T12:00:00Z",
  "displayName": "string",
  "kindId": "00000000-0000-0000-0000-000000000000",
  "name": "string",
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/kind/{name}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/kind/{name}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/kind/{name}");

print_r($result);
?>
```

## Get a log subscription

`GET /v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/subscription/{subscriptionId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/analytics/opensearch/observability/#get-publiccloud-project-projectid-managedanalytics-opensearch-serviceid-log-subscription-subscriptionid

**Status:** Beta version  
**IAM actions:** `publicCloudProject:apiovh:analytics/opensearch/log/subscription/get`

Returns the log kind and the destination stream of a subscription.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `projectId` | path | string | yes | Project ID |
| `serviceId` | path | string (uuid) | yes | Service ID |
| `subscriptionId` | path | string (uuid) | yes | Subscription ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | dbaas.logs.LogSubscription | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `createdAt` | string (date-time) | read-only | Creation date of the subscription |
| `kind` | string | read-only | Log kind name of this subscription |
| `resource` | dbaas.logs.LogSubscriptionResource | read-only | Subscribed resource, where the logs come from |
| `resource.name` | string | read-only | Name of subscribed resource |
| `resource.type` | string | read-only | Type of subscribed resource |
| `serviceName` | string | read-only | Name of the destination log service |
| `streamId` | string | read-only | Identifier of the destination log stream |
| `subscriptionId` | string (uuid) | read-only | Unique identifier of the subscription, used to change or stop the forwarding |
| `updatedAt` | string (date-time) | read-only | Last update date of the subscription |

```json
{
  "createdAt": "2024-01-01T12:00:00Z",
  "kind": "string",
  "resource": {
    "name": "string",
    "type": "string"
  },
  "serviceName": "string",
  "streamId": "string",
  "subscriptionId": "00000000-0000-0000-0000-000000000000",
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/subscription/{subscriptionId}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/subscription/{subscriptionId}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/subscription/{subscriptionId}");

print_r($result);
?>
```

## Get a metric

`GET /v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/metric/{metricName}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/analytics/opensearch/observability/#get-publiccloud-project-projectid-managedanalytics-opensearch-serviceid-metric-metricname

**Status:** Beta version  
**IAM actions:** `publicCloudProject:apiovh:analytics/opensearch/metric/get`

Returns the values of a metric for each node of the service, over the requested period.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `metricName` | path | string | yes | Metric name |
| `period` | query | publicCloud.database.MetricPeriodEnum |  | Time period over which to retrieve metric values — one of `LAST_DAY`, `LAST_HOUR`, `LAST_MONTH`, `LAST_WEEK`, `LAST_YEAR` |
| `projectId` | path | string | yes | Project ID |
| `serviceId` | path | string (uuid) | yes | Service ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.database.Metric | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `metrics` | publicCloud.database.HostMetric[] | read-only | Metric values for each host in the cluster |
| `metrics[].dataPoints` | publicCloud.database.DataPoint[] | read-only | List of metric samples |
| `metrics[].dataPoints[].timestamp` | integer | read-only | Timestamp in seconds since epoch |
| `metrics[].dataPoints[].value` | number | read-only | Value of the data point |
| `metrics[].hostname` | string | read-only | Name of the originating host |
| `name` | string | read-only | Name of the metric |
| `unit` | publicCloud.database.MetricUnitEnum | read-only | Unit of the metric values — one of `BYTES`, `BYTES_PER_SECOND`, `GIGABYTES`, `GIGABYTES_PER_HOUR`, `MEGABYTES`, `MEGABYTES_PER_SECOND`, `MILLISECONDS`, `PERCENT`, `SCALAR`, `SCALAR_PER_SECOND`, `SECONDS`, `UNKNOWN` |

```json
{
  "metrics": [
    {
      "dataPoints": [
        {
          "timestamp": 0,
          "value": 0
        }
      ],
      "hostname": "string"
    }
  ],
  "name": "string",
  "unit": "BYTES"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/metric/{metricName}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/metric/{metricName}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/metric/{metricName}");

print_r($result);
?>
```

## Get the Prometheus endpoint

`GET /v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/prometheus`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/analytics/opensearch/observability/#get-publiccloud-project-projectid-managedanalytics-opensearch-serviceid-prometheus

**Status:** Beta version  
**IAM actions:** `publicCloudProject:apiovh:analytics/opensearch/prometheus/get`

Returns the scraping targets and the username for Prometheus authentication. The password is returned only by a credentials reset.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `projectId` | path | string | yes | Project ID |
| `serviceId` | path | string (uuid) | yes | Service ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.database.PrometheusEndpoint | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `targets` | publicCloud.database.PrometheusTarget[] | read-only | Scraping targets |
| `targets[].host` | string | read-only | Hostname of the target |
| `targets[].port` | integer | read-only | Port of the target |
| `username` | string | read-only | Username for Prometheus authentication |

```json
{
  "targets": [
    {
      "host": "string",
      "port": 0
    }
  ],
  "username": "string"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/prometheus" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/prometheus")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/prometheus");

print_r($result);
?>
```

## Create a log subscription

`POST /v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/subscription`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/analytics/opensearch/observability/#post-publiccloud-project-projectid-managedanalytics-opensearch-serviceid-log-subscription

**Status:** Beta version  
**IAM actions:** `publicCloudProject:apiovh:analytics/opensearch/log/subscription/create`

Forwards OpenSearch logs of one kind to a Logs Data Platform stream. The subscription is created asynchronously and the response returns the operation identifier.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `projectId` | path | string | yes | Project ID |
| `serviceId` | path | string (uuid) | yes | Service ID |

### Request body (required)

Type: `dbaas.logs.LogSubscriptionCreation`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | string | yes | Log kind name to subscribe to |
| `streamId` | string (uuid) | yes | Identifier of the customer log stream |

```json
{
  "kind": "string",
  "streamId": "00000000-0000-0000-0000-000000000000"
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | dbaas.logs.LogSubscriptionResponse | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `operationId` | string (uuid) | read-only | Identifier of the operation |
| `serviceName` | string | read-only | Operation owner's service name |

```json
{
  "operationId": "00000000-0000-0000-0000-000000000000",
  "serviceName": "string"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/subscription" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

# Request body type: dbaas.logs.LogSubscriptionCreation
result = client.post("/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/subscription",
	kind = None, # Log kind name to subscribe to (type: string)
	streamId = None, # Identifier of the customer log stream (type: string)
)

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

// Request body type: dbaas.logs.LogSubscriptionCreation
$result = $ovh->post("/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/subscription", array(
	kind => null, // Log kind name to subscribe to (type: string)
	streamId => null, // Identifier of the customer log stream (type: string)
));

print_r($result);
?>
```

## Generate a temporary log URL

`POST /v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/url`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/analytics/opensearch/observability/#post-publiccloud-project-projectid-managedanalytics-opensearch-serviceid-log-url

**Status:** Beta version  
**IAM actions:** `publicCloudProject:apiovh:analytics/opensearch/log/url/create`

Generates a temporary URL to read the logs of one kind. The URL expires.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `projectId` | path | string | yes | Project ID |
| `serviceId` | path | string (uuid) | yes | Service ID |

### Request body (required)

Type: `dbaas.logs.LogUrlCreation`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | string | yes | Log kind name |

```json
{
  "kind": "string"
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | dbaas.logs.TemporaryLogsLink | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `expirationDate` | string (date-time) | read-only | Temporary url expiration date |
| `url` | string | read-only | Temporary url |

```json
{
  "expirationDate": "2024-01-01T12:00:00Z",
  "url": "string"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/url" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

# Request body type: dbaas.logs.LogUrlCreation
result = client.post("/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/url",
	kind = None, # Log kind name (type: string)
)

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

// Request body type: dbaas.logs.LogUrlCreation
$result = $ovh->post("/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/url", array(
	kind => null, // Log kind name (type: string)
));

print_r($result);
?>
```

## Reset the Prometheus credentials

`POST /v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/prometheus/credentials/reset`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/analytics/opensearch/observability/#post-publiccloud-project-projectid-managedanalytics-opensearch-serviceid-prometheus-credentials-reset

**Status:** Beta version  
**IAM actions:** `publicCloudProject:apiovh:analytics/opensearch/prometheus/credentials/reset`

Resets the Prometheus password. The previous password stops working immediately and the new credentials are returned in the response.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `projectId` | path | string | yes | Project ID |
| `serviceId` | path | string (uuid) | yes | Service ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.database.PrometheusAccess | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `password` | string (password) | read-only | Password for Prometheus authentication |
| `username` | string | read-only | Username for Prometheus authentication |

```json
{
  "password": "string",
  "username": "string"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/prometheus/credentials/reset" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.post("/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/prometheus/credentials/reset")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->post("/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/prometheus/credentials/reset");

print_r($result);
?>
```

## Delete a log subscription

`DELETE /v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/subscription/{subscriptionId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/analytics/opensearch/observability/#delete-publiccloud-project-projectid-managedanalytics-opensearch-serviceid-log-subscription-subscriptionid

**Status:** Beta version  
**IAM actions:** `publicCloudProject:apiovh:analytics/opensearch/log/subscription/delete`

Deletes the subscription and stops forwarding OpenSearch logs to the stream.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `projectId` | path | string | yes | Project ID |
| `serviceId` | path | string (uuid) | yes | Service ID |
| `subscriptionId` | path | string (uuid) | yes | Subscription ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | dbaas.logs.LogSubscriptionResponse | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `operationId` | string (uuid) | read-only | Identifier of the operation |
| `serviceName` | string | read-only | Operation owner's service name |

```json
{
  "operationId": "00000000-0000-0000-0000-000000000000",
  "serviceName": "string"
}
```

### Example

```bash
curl -X DELETE \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/subscription/{subscriptionId}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.delete("/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/subscription/{subscriptionId}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->delete("/v2/publicCloud/project/{projectId}/managedAnalytics/opensearch/{serviceId}/log/subscription/{subscriptionId}");

print_r($result);
?>
```
