# 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>](/cloud/observability/logging-service/overview/log-pipelines.md).

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

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:**

* <code class="expression">space.vars.ionos\_cloud</code> 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>](/cloud/observability/logging-service/api-how-tos/retrieve-logging-pipeline-information.md).

## 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"
                ]
            }
        ]
    }
}'
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ionos.com/cloud/observability/logging-service/api-how-tos/set-up-logging-pipeline-instance.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
