# Set Up a Logging Pipeline Instance

It is necessary to create an instance of the logging pipeline before sending log data to the Logging Service platform. For more information, see [<mark style="color:blue;">Log Pipelines</mark>](https://docs.ionos.com/sections-test/guides/observability/logging-service/overview/log-pipelines).

For more information about the complete list of available sources, see [<mark style="color:blue;">Log Sources</mark>](https://docs.ionos.com/sections-test/guides/observability/logging-service/overview/log-sources).

This topic contains the following sections:

* [<mark style="color:blue;">Request to create a logging pipeline</mark>](#request-to-create-a-logging-pipeline)
* [<mark style="color:blue;">Sample response</mark>](#response)
* [<mark style="color:blue;">Create a pipeline with custom labels</mark>](#create-a-pipeline-with-custom-labels)

## Request to create a logging pipeline

The following request creates an instance of a logging pipeline with two log streams: `docker` and `kubernetes`.

{% hint style="warning" %}
**Warning:**

* IONOS Cloud supports unique email addresses across all contracts in each region.
  {% endhint %}

```bash
curl --location \ 
--request POST 'https://logging.de-txl.ionos.com/pipelines' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $TOKEN' \
--data '{
  "properties": {
    "name": "demo",
    "logs": [
      {
        "source": "docker",
        "tag": "dock",
        "protocol": "tcp",
        "labels": [
          "label1d"
        ],
        "destinations": [
          {
            "type": "loki",
            "retentionInDays": 7
          }
        ]
      }, 
            {
             "source": "kubernetes",
             "tag": "k8s",
             "protocol": "tcp",
            "destinations":  
            [
              {
              "type": "loki",
              "retentionInDays": 14
              }
            ]
           }
    ]
  }
}'
```

## Response

The following is a sample response. The values returned by each response differ based on the request.

```json
{
    "id": "aaaaa-bbbb-1234-cccc-dddd",
    "type": "Pipeline",
    "metadata": {
        "createdDate": "2023-10-19T11:48:31Z",
        "createdBy": "abc@ionos.com",
        "createdByUserId": "ID",
        "createdByUserUuid": "UUID",
        "lastModifiedDate": "2023-10-19T11:48:31Z",
        "lastModifiedBy": "abc@ionos.com",
        "lastModifiedByUserId": "ID",
        "lastModifiedByUserUuid": "UUID",
        "status": "PROVISIONING"
    },
    "properties": {
        "name": "demo",
        "logs": [
            {
                "public": true,
                "source": "docker",
                "tag": "dock",
                "destinations": [
                    {
                        "type": "loki",
                        "retentionInDays": 7
                    }
                ],
                "labels": [
                    "label1d"
                ],
                "protocol": "tcp"
            },
            {
                "public": true,
                "source": "kubernetes",
                "tag": "k8s",
                "destinations": [
                    {
                        "type": "loki",
                        "retentionInDays": 14
                    }
                ],
                "protocol": "tcp"
            }
        ],
        "tcpAddress": "",
        "httpAddress": "",
        "grafanaAddress": "",
        "key": "key"
    }
}
```

You may notice that the pipeline's status is temporarily set to the `PROVISIONING` state while provisioning is in process. A `GET` request retrieves information about the pipeline and its status. For more information, see [<mark style="color:blue;">Retrieve logging pipeline information</mark>](https://docs.ionos.com/sections-test/guides/observability/logging-service/api-how-tos/retrieve-logging-pipeline-information).

## Create a pipeline with custom labels

Log sources like Kubernetes, Docker, and Linux Systemd collect and offer relevant labels. You can use these labels to analyze reports and query the dashboard. However, if you want to label additional fields from the log sources, you can define custom labels as follows when you create a pipeline:

```bash
curl --location \ 
--request POST 'https://logging.de-txl.ionos.com/pipelines' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $TOKEN' \
--data '{
    "properties": {
        "name": "demo",
        "logs": [
            {
                "source": "docker",
                "tag": "dock",
                "protocol": "tcp",
                "labels": [
                    "label1",
                    "label2"
                ]
            }
        ]
    }
}'
```
