For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/api/latest/logs-pipelines/create-a-pipeline.md. A documentation index is available at /llms.txt.
Language
Datadog site

Create a pipeline

POSThttps://api.datadoghq.com/api/v1/logs/config/pipelineshttps://api.us3.datadoghq.com/api/v1/logs/config/pipelineshttps://api.us5.datadoghq.com/api/v1/logs/config/pipelineshttps://api.datadoghq.eu/api/v1/logs/config/pipelineshttps://api.ap1.datadoghq.com/api/v1/logs/config/pipelineshttps://api.ap2.datadoghq.com/api/v1/logs/config/pipelineshttps://api.uk1.datadoghq.com/api/v1/logs/config/pipelineshttps://api.ddog-gov.com/api/v1/logs/config/pipelineshttps://api.us2.ddog-gov.com/api/v1/logs/config/pipelines

Overview

Create a pipeline in your organization.

This endpoint requires the logs_write_pipelines permission.

Request

Body Data (required)

Definition of the new pipeline.

Field
Type
Description
description
string

A description of the pipeline.

filter
object

Filter for logs.

is_enabled
boolean

Whether or not the pipeline is enabled.

name [required]
string

Name of the pipeline.

processors
[<oneOf>]

Ordered list of processors in this pipeline.

tags
[string]

A list of tags associated with the pipeline.

Response

OK

Pipelines and processors operate on incoming logs, parsing and transforming them into structured attributes for easier querying.

Note: These endpoints are only available for admin users. Make sure to use an application key created by an admin.

Field
Type
Description
description
string

A description of the pipeline.

filter
object

Filter for logs.

id
string

ID of the pipeline.

is_enabled
boolean

Whether or not the pipeline is enabled.

is_read_only
boolean

Whether or not the pipeline can be edited.

name [required]
string

Name of the pipeline.

processors
[<oneOf>]

Ordered list of processors in this pipeline.

tags
[string]

A list of tags associated with the pipeline.

type
string

Type of pipeline.

Code Example

Create a pipeline with Array Map Processor returns "OK" response
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/logs/config/pipelines" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "filter": {
    "query": "source:python"
  },
  "name": "testPipelineArrayMap",
  "processors": [
    {
      "type": "array-map-processor",
      "is_enabled": true,
      "name": "map items",
      "source": "items",
      "target": "out",
      "preserve_source": true,
      "processors": [
        {
          "type": "attribute-remapper",
          "sources": [
            "$sourceElem.id"
          ],
          "target": "$targetElem.uid",
          "preserve_source": true
        },
        {
          "type": "string-builder-processor",
          "template": "item-%{$sourceElem.id}",
          "target": "$targetElem.label"
        }
      ]
    }
  ],
  "tags": []
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/logs/config/pipelines" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "filter": {
    "query": "source:python"
  },
  "name": "testPipelineArrayMap",
  "processors": [
    {
      "type": "array-map-processor",
      "is_enabled": true,
      "name": "map items",
      "source": "items",
      "target": "out",
      "preserve_source": true,
      "processors": [
        {
          "type": "attribute-remapper",
          "sources": [
            "$sourceElem.id"
          ],
          "target": "$targetElem.uid",
          "preserve_source": true
        },
        {
          "type": "string-builder-processor",
          "template": "item-%{$sourceElem.id}",
          "target": "$targetElem.label"
        }
      ]
    }
  ],
  "tags": []
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/logs/config/pipelines" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "filter": {
    "query": "source:python"
  },
  "name": "testPipelineArrayMap",
  "processors": [
    {
      "type": "array-map-processor",
      "is_enabled": true,
      "name": "map items",
      "source": "items",
      "target": "out",
      "preserve_source": true,
      "processors": [
        {
          "type": "attribute-remapper",
          "sources": [
            "$sourceElem.id"
          ],
          "target": "$targetElem.uid",
          "preserve_source": true
        },
        {
          "type": "string-builder-processor",
          "template": "item-%{$sourceElem.id}",
          "target": "$targetElem.label"
        }
      ]
    }
  ],
  "tags": []
}
EOF
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/logs/config/pipelines" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "filter": {
    "query": "source:python"
  },
  "name": "testPipelineArrayMap",
  "processors": [
    {
      "type": "array-map-processor",
      "is_enabled": true,
      "name": "map items",
      "source": "items",
      "target": "out",
      "preserve_source": true,
      "processors": [
        {
          "type": "attribute-remapper",
          "sources": [
            "$sourceElem.id"
          ],
          "target": "$targetElem.uid",
          "preserve_source": true
        },
        {
          "type": "string-builder-processor",
          "template": "item-%{$sourceElem.id}",
          "target": "$targetElem.label"
        }
      ]
    }
  ],
  "tags": []
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/logs/config/pipelines" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "filter": {
    "query": "source:python"
  },
  "name": "testPipelineArrayMap",
  "processors": [
    {
      "type": "array-map-processor",
      "is_enabled": true,
      "name": "map items",
      "source": "items",
      "target": "out",
      "preserve_source": true,
      "processors": [
        {
          "type": "attribute-remapper",
          "sources": [
            "$sourceElem.id"
          ],
          "target": "$targetElem.uid",
          "preserve_source": true
        },
        {
          "type": "string-builder-processor",
          "template": "item-%{$sourceElem.id}",
          "target": "$targetElem.label"
        }
      ]
    }
  ],
  "tags": []
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/logs/config/pipelines" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "filter": {
    "query": "source:python"
  },
  "name": "testPipelineArrayMap",
  "processors": [
    {
      "type": "array-map-processor",
      "is_enabled": true,
      "name": "map items",
      "source": "items",
      "target": "out",
      "preserve_source": true,
      "processors": [
        {
          "type": "attribute-remapper",
          "sources": [
            "$sourceElem.id"
          ],
          "target": "$targetElem.uid",
          "preserve_source": true
        },
        {
          "type": "string-builder-processor",
          "template": "item-%{$sourceElem.id}",
          "target": "$targetElem.label"
        }
      ]
    }
  ],
  "tags": []
}
EOF
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/logs/config/pipelines" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "filter": {
    "query": "source:python"
  },
  "name": "testPipelineArrayMap",
  "processors": [
    {
      "type": "array-map-processor",
      "is_enabled": true,
      "name": "map items",
      "source": "items",
      "target": "out",
      "preserve_source": true,
      "processors": [
        {
          "type": "attribute-remapper",
          "sources": [
            "$sourceElem.id"
          ],
          "target": "$targetElem.uid",
          "preserve_source": true
        },
        {
          "type": "string-builder-processor",
          "template": "item-%{$sourceElem.id}",
          "target": "$targetElem.label"
        }
      ]
    }
  ],
  "tags": []
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/logs/config/pipelines" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "filter": {
    "query": "source:python"
  },
  "name": "testPipelineArrayMap",
  "processors": [
    {
      "type": "array-map-processor",
      "is_enabled": true,
      "name": "map items",
      "source": "items",
      "target": "out",
      "preserve_source": true,
      "processors": [
        {
          "type": "attribute-remapper",
          "sources": [
            "$sourceElem.id"
          ],
          "target": "$targetElem.uid",
          "preserve_source": true
        },
        {
          "type": "string-builder-processor",
          "template": "item-%{$sourceElem.id}",
          "target": "$targetElem.label"
        }
      ]
    }
  ],
  "tags": []
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/logs/config/pipelines" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "filter": {
    "query": "source:python"
  },
  "name": "testPipelineArrayMap",
  "processors": [
    {
      "type": "array-map-processor",
      "is_enabled": true,
      "name": "map items",
      "source": "items",
      "target": "out",
      "preserve_source": true,
      "processors": [
        {
          "type": "attribute-remapper",
          "sources": [
            "$sourceElem.id"
          ],
          "target": "$targetElem.uid",
          "preserve_source": true
        },
        {
          "type": "string-builder-processor",
          "template": "item-%{$sourceElem.id}",
          "target": "$targetElem.label"
        }
      ]
    }
  ],
  "tags": []
}
EOF
Create a pipeline with Array Map Processor using arithmetic sub-processor returns "OK" response
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/logs/config/pipelines" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "filter": {
    "query": "source:python"
  },
  "name": "testPipelineArrayMapArithmetic",
  "processors": [
    {
      "type": "array-map-processor",
      "is_enabled": true,
      "name": "double counts",
      "source": "items",
      "target": "out",
      "processors": [
        {
          "type": "arithmetic-processor",
          "expression": "$sourceElem.count * 2",
          "target": "$targetElem.doubled"
        }
      ]
    }
  ],
  "tags": []
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/logs/config/pipelines" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "filter": {
    "query": "source:python"
  },
  "name": "testPipelineArrayMapArithmetic",
  "processors": [
    {
      "type": "array-map-processor",
      "is_enabled": true,
      "name": "double counts",
      "source": "items",
      "target": "out",
      "processors": [
        {
          "type": "arithmetic-processor",
          "expression": "$sourceElem.count * 2",
          "target": "$targetElem.doubled"
        }
      ]
    }
  ],
  "tags": []
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/logs/config/pipelines" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "filter": {
    "query": "source:python"
  },
  "name": "testPipelineArrayMapArithmetic",
  "processors": [
    {
      "type": "array-map-processor",
      "is_enabled": true,
      "name": "double counts",
      "source": "items",
      "target": "out",
      "processors": [
        {
          "type": "arithmetic-processor",
          "expression": "$sourceElem.count * 2",
          "target": "$targetElem.doubled"
        }
      ]
    }
  ],
  "tags": []
}
EOF
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/logs/config/pipelines" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "filter": {
    "query": "source:python"
  },
  "name": "testPipelineArrayMapArithmetic",
  "processors": [
    {
      "type": "array-map-processor",
      "is_enabled": true,
      "name": "double counts",
      "source": "items",
      "target": "out",
      "processors": [
        {
          "type": "arithmetic-processor",
          "expression": "$sourceElem.count * 2",
          "target": "$targetElem.doubled"
        }
      ]
    }
  ],
  "tags": []
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/logs/config/pipelines" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "filter": {
    "query": "source:python"
  },
  "name": "testPipelineArrayMapArithmetic",
  "processors": [
    {
      "type": "array-map-processor",
      "is_enabled": true,
      "name": "double counts",
      "source": "items",
      "target": "out",
      "processors": [
        {
          "type": "arithmetic-processor",
          "expression": "$sourceElem.count * 2",
          "target": "$targetElem.doubled"
        }
      ]
    }
  ],
  "tags": []
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/logs/config/pipelines" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "filter": {
    "query": "source:python"
  },
  "name": "testPipelineArrayMapArithmetic",
  "processors": [
    {
      "type": "array-map-processor",
      "is_enabled": true,
      "name": "double counts",
      "source": "items",
      "target": "out",
      "processors": [
        {
          "type": "arithmetic-processor",
          "expression": "$sourceElem.count * 2",
          "target": "$targetElem.doubled"
        }
      ]
    }
  ],
  "tags": []
}
EOF
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/logs/config/pipelines" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "filter": {
    "query": "source:python"
  },
  "name": "testPipelineArrayMapArithmetic",
  "processors": [
    {
      "type": "array-map-processor",
      "is_enabled": true,
      "name": "double counts",
      "source": "items",
      "target": "out",
      "processors": [
        {
          "type": "arithmetic-processor",
          "expression": "$sourceElem.count * 2",
          "target": "$targetElem.doubled"
        }
      ]
    }
  ],
  "tags": []
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/logs/config/pipelines" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "filter": {
    "query": "source:python"
  },
  "name": "testPipelineArrayMapArithmetic",
  "processors": [
    {
      "type": "array-map-processor",
      "is_enabled": true,
      "name": "double counts",
      "source": "items",
      "target": "out",
      "processors": [
        {
          "type": "arithmetic-processor",
          "expression": "$sourceElem.count * 2",
          "target": "$targetElem.doubled"
        }
      ]
    }
  ],
  "tags": []
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/logs/config/pipelines" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "filter": {
    "query": "source:python"
  },
  "name": "testPipelineArrayMapArithmetic",
  "processors": [
    {
      "type": "array-map-processor",
      "is_enabled": true,
      "name": "double counts",
      "source": "items",
      "target": "out",
      "processors": [
        {
          "type": "arithmetic-processor",
          "expression": "$sourceElem.count * 2",
          "target": "$targetElem.doubled"
        }
      ]
    }
  ],
  "tags": []
}
EOF
Create a pipeline with Array Map Processor using category sub-processor returns "OK" response
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/logs/config/pipelines" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "filter": {
    "query": "source:python"
  },
  "name": "testPipelineArrayMapCategory",
  "processors": [
    {
      "type": "array-map-processor",
      "is_enabled": true,
      "name": "categorize items",
      "source": "items",
      "target": "out",
      "processors": [
        {
          "type": "category-processor",
          "target": "$targetElem.level",
          "categories": [
            {
              "filter": {
                "query": "@$sourceElem.status:error"
              },
              "name": "error"
            },
            {
              "filter": {
                "query": "*"
              },
              "name": "info"
            }
          ]
        }
      ]
    }
  ],
  "tags": []
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/logs/config/pipelines" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "filter": {
    "query": "source:python"
  },
  "name": "testPipelineArrayMapCategory",
  "processors": [
    {
      "type": "array-map-processor",
      "is_enabled": true,
      "name": "categorize items",
      "source": "items",
      "target": "out",
      "processors": [
        {
          "type": "category-processor",
          "target": "$targetElem.level",
          "categories": [
            {
              "filter": {
                "query": "@$sourceElem.status:error"
              },
              "name": "error"
            },
            {
              "filter": {
                "query": "*"
              },
              "name": "info"
            }
          ]
        }
      ]
    }
  ],
  "tags": []
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/logs/config/pipelines" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "filter": {
    "query": "source:python"
  },
  "name": "testPipelineArrayMapCategory",
  "processors": [
    {
      "type": "array-map-processor",
      "is_enabled": true,
      "name": "categorize items",
      "source": "items",
      "target": "out",
      "processors": [
        {
          "type": "category-processor",
          "target": "$targetElem.level",
          "categories": [
            {
              "filter": {
                "query": "@$sourceElem.status:error"
              },
              "name": "error"
            },
            {
              "filter": {
                "query": "*"
              },
              "name": "info"
            }
          ]
        }
      ]
    }
  ],
  "tags": []
}
EOF
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/logs/config/pipelines" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "filter": {
    "query": "source:python"
  },
  "name": "testPipelineArrayMapCategory",
  "processors": [
    {
      "type": "array-map-processor",
      "is_enabled": true,
      "name": "categorize items",
      "source": "items",
      "target": "out",
      "processors": [
        {
          "type": "category-processor",
          "target": "$targetElem.level",
          "categories": [
            {
              "filter": {
                "query": "@$sourceElem.status:error"
              },
              "name": "error"
            },
            {
              "filter": {
                "query": "*"
              },
              "name": "info"
            }
          ]
        }
      ]
    }
  ],
  "tags": []
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/logs/config/pipelines" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "filter": {
    "query": "source:python"
  },
  "name": "testPipelineArrayMapCategory",
  "processors": [
    {
      "type": "array-map-processor",
      "is_enabled": true,
      "name": "categorize items",
      "source": "items",
      "target": "out",
      "processors": [
        {
          "type": "category-processor",
          "target": "$targetElem.level",
          "categories": [
            {
              "filter": {
                "query": "@$sourceElem.status:error"
              },
              "name": "error"
            },
            {
              "filter": {
                "query": "*"
              },
              "name": "info"
            }
          ]
        }
      ]
    }
  ],
  "tags": []
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/logs/config/pipelines" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "filter": {
    "query": "source:python"
  },
  "name": "testPipelineArrayMapCategory",
  "processors": [
    {
      "type": "array-map-processor",
      "is_enabled": true,
      "name": "categorize items",
      "source": "items",
      "target": "out",
      "processors": [
        {
          "type": "category-processor",
          "target": "$targetElem.level",
          "categories": [
            {
              "filter": {
                "query": "@$sourceElem.status:error"
              },
              "name": "error"
            },
            {
              "filter": {
                "query": "*"
              },
              "name": "info"
            }
          ]
        }
      ]
    }
  ],
  "tags": []
}
EOF
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/logs/config/pipelines" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "filter": {
    "query": "source:python"
  },
  "name": "testPipelineArrayMapCategory",
  "processors": [
    {
      "type": "array-map-processor",
      "is_enabled": true,
      "name": "categorize items",
      "source": "items",
      "target": "out",
      "processors": [
        {
          "type": "category-processor",
          "target": "$targetElem.level",
          "categories": [
            {
              "filter": {
                "query": "@$sourceElem.status:error"
              },
              "name": "error"
            },
            {
              "filter": {
                "query": "*"
              },
              "name": "info"
            }
          ]
        }
      ]
    }
  ],
  "tags": []
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/logs/config/pipelines" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "filter": {
    "query": "source:python"
  },
  "name": "testPipelineArrayMapCategory",
  "processors": [
    {
      "type": "array-map-processor",
      "is_enabled": true,
      "name": "categorize items",
      "source": "items",
      "target": "out",
      "processors": [
        {
          "type": "category-processor",
          "target": "$targetElem.level",
          "categories": [
            {
              "filter": {
                "query": "@$sourceElem.status:error"
              },
              "name": "error"
            },
            {
              "filter": {
                "query": "*"
              },
              "name": "info"
            }
          ]
        }
      ]
    }
  ],
  "tags": []
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v1/logs/config/pipelines" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "filter": {
    "query": "source:python"
  },
  "name": "testPipelineArrayMapCategory",
  "processors": [
    {
      "type": "array-map-processor",
      "is_enabled": true,
      "name": "categorize items",
      "source": "items",
      "target": "out",
      "processors": [
        {
          "type": "category-processor",
          "target": "$targetElem.level",
          "categories": [
            {
              "filter": {
                "query": "@$sourceElem.status:error"
              },
              "name": "error"
            },
            {
              "filter": {
                "query": "*"
              },
              "name": "info"
            }
          ]
        }
      ]
    }
  ],
  "tags": []
}
EOF