# Public Cloud › Container › Managed Kubernetes Service › 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

> 5 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/container/managed-kubernetes-service/observability/

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

## Operations

- `GET /cloud/project/{serviceName}/kube/{kubeId}/log/subscription` — List log subscriptions
- `GET /cloud/project/{serviceName}/kube/{kubeId}/log/subscription/{subscriptionId}` — Get a log subscription
- `POST /cloud/project/{serviceName}/kube/{kubeId}/log/subscription` — Create a log subscription
- `POST /cloud/project/{serviceName}/kube/{kubeId}/log/url` — Generate a temporary log URL
- `DELETE /cloud/project/{serviceName}/kube/{kubeId}/log/subscription/{subscriptionId}` — Delete a log subscription

## List log subscriptions

`GET /1.0/cloud/project/{serviceName}/kube/{kubeId}/log/subscription`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/container/managed-kubernetes-service/observability/#get-cloud-project-servicename-kube-kubeid-log-subscription

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:kube/log/subscription/get`

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

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `kind` | query | string |  | Filter on a specific kind (e.g., audit) |
| `kubeId` | path | string | yes | Kube ID |
| `serviceName` | path | string | yes | Service name |

### 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/1.0/cloud/project/{serviceName}/kube/{kubeId}/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("/cloud/project/{serviceName}/kube/{kubeId}/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("/cloud/project/{serviceName}/kube/{kubeId}/log/subscription");

print_r($result);
?>
```

## Get a log subscription

`GET /1.0/cloud/project/{serviceName}/kube/{kubeId}/log/subscription/{subscriptionId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/container/managed-kubernetes-service/observability/#get-cloud-project-servicename-kube-kubeid-log-subscription-subscriptionid

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:kube/log/subscription/get`

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

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `kubeId` | path | string | yes | Kube ID |
| `serviceName` | path | string | yes | Service name |
| `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.SubscriptionResource | 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 | Id of the destination log stream |
| `subscriptionId` | string (uuid) | read-only | Subscription ID |
| `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/1.0/cloud/project/{serviceName}/kube/{kubeId}/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("/cloud/project/{serviceName}/kube/{kubeId}/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("/cloud/project/{serviceName}/kube/{kubeId}/log/subscription/{subscriptionId}");

print_r($result);
?>
```

## Create a log subscription

`POST /1.0/cloud/project/{serviceName}/kube/{kubeId}/log/subscription`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/container/managed-kubernetes-service/observability/#post-cloud-project-servicename-kube-kubeid-log-subscription

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:kube/log/subscription/create`, `ldp:apiovh:output/graylog/stream/forwardTo`

Forwards Managed Kubernetes 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 |
| --- | --- | --- | --- | --- |
| `kubeId` | path | string | yes | Kube ID |
| `serviceName` | path | string | yes | Service name |

### Request body (required)

Type: `dbaas.logs.LogSubscriptionCreation`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | string | yes | Log kind name to subscribe to |
| `streamId` | string (uuid) | yes | Customer log stream ID |

```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/1.0/cloud/project/{serviceName}/kube/{kubeId}/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("/cloud/project/{serviceName}/kube/{kubeId}/log/subscription",
	kind = None, # Log kind name to subscribe to (type: string)
	streamId = None, # Customer log stream ID (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("/cloud/project/{serviceName}/kube/{kubeId}/log/subscription", array(
	kind => null, // Log kind name to subscribe to (type: string)
	streamId => null, // Customer log stream ID (type: string)
));

print_r($result);
?>
```

## Generate a temporary log URL

`POST /1.0/cloud/project/{serviceName}/kube/{kubeId}/log/url`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/container/managed-kubernetes-service/observability/#post-cloud-project-servicename-kube-kubeid-log-url

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:kube/log/url/create`

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

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `kubeId` | path | string | yes | Kube ID |
| `serviceName` | path | string | yes | Service name |

### 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/1.0/cloud/project/{serviceName}/kube/{kubeId}/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("/cloud/project/{serviceName}/kube/{kubeId}/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("/cloud/project/{serviceName}/kube/{kubeId}/log/url", array(
	kind => null, // Log kind name (type: string)
));

print_r($result);
?>
```

## Delete a log subscription

`DELETE /1.0/cloud/project/{serviceName}/kube/{kubeId}/log/subscription/{subscriptionId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/container/managed-kubernetes-service/observability/#delete-cloud-project-servicename-kube-kubeid-log-subscription-subscriptionid

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:kube/log/subscription/delete`

Deletes the subscription and stops forwarding Managed Kubernetes logs to the stream.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `kubeId` | path | string | yes | Kube ID |
| `serviceName` | path | string | yes | Service name |
| `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/1.0/cloud/project/{serviceName}/kube/{kubeId}/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("/cloud/project/{serviceName}/kube/{kubeId}/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("/cloud/project/{serviceName}/kube/{kubeId}/log/subscription/{subscriptionId}");

print_r($result);
?>
```
