Skip to content

Create



POST /api/v1/pipeline/add

Overview

Create a Pipeline

When the category is profiling, the rule will only take effect if the workspace configuration field CentralPLServiceSwitch (returned by the /workspace/get interface) is true.

Body Request Parameters

Parameter Name Type Required Description
name string Y Pipeline file name
Allow empty: False
Maximum length: 256
$notSearchRegExp: [^a-zA-Z0-9_\u4e00-\u9fa5-]+
type string Y Pipeline file type
Allow empty: False
Optional values: ['local', 'central']
source array Selected source list
Allow empty: False
content string Y Pipeline file content (base64 encoded)
Allow empty: False
testData string Test data (base64 encoded). OpenAPI only allows empty strings or content where the base64 decoded result is a JSON array.

Generation method: 1. First prepare the test sample array; 2. Perform JSON.stringify on the array; 3. Encode the resulting UTF-8 string with base64 and pass it to testData.

Common examples: - Empty sample array: [] -> W10= - Single JSON log: [{"level":"info","msg":"HTTP"}] -> W3sibGV2ZWwiOiJpbmZvIiwibXNnIjoiSFRUUCJ9XQ== - Single text log: ["raw log line"] -> WyJyYXcgbG9nIGxpbmUiXQ==

Invalid example: Directly base64 encode {"level":"info","msg":"HTTP"} and pass it, because the decoded top-level is an object, not an array.
Allow empty: False
Allow empty string: True
| | dataType | string | | Data type line_protocol-line protocol format; json-JSON format; message-Message
Example: line_protocol
Allow empty: False
Allow empty string: True
Optional values: ['line_protocol', 'json', 'message']
| | isForce | boolean | | Whether to replace when a specific type has a default
Allow empty: False
| | category | string | Y | Category
Allow empty: False
Allow empty string: False
Optional values: ['logging', 'object', 'custom_object', 'network', 'tracing', 'rum', 'llm', 'agent_monitor', 'security', 'keyevent', 'metric', 'profiling', 'dialtesting', 'billing', 'keyevent']
| | asDefault | int | | Whether to set as the default pipeline for this type, 1 for default, 0 for non-default
Allow empty: False
| | enableByLogBackup | int | | Enable Pipeline to process forwarded data, 1 for enable, 0 for disable
Allow empty: False
| | extend | json | | Category
Allow empty: False
| | extend.appID | array | | appID
Allow empty: True
| | extend.measurement | array | | Source
Allow empty: True
| | extend.loggingIndex | string | | Log index
Allow empty: True
|

Parameter Supplementary Description

Request Example

curl 'https://openapi.guance.com/api/v1/pipeline/add' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{"name":"openapi_test","category":"logging","asDefault":0,"content":"YWRkX2tleShjaXR5LCAic2hhbmdoYWkiKQ==","testData":"W3sibGV2ZWwiOiJpbmZvIiwibXNnIjoiSFRUUCJ9XQ==","source":["nsqlookupd"]}' \
--compressed

Response

{
    "code": 200,
    "content": {
        "asDefault": 0,
        "category": "logging",
        "content": "YWRkX2tleShjaXR5LCAic2hhbmdoYWkiKQ==\n",
        "createAt": 1678026470,
        "creator": "xxxx",
        "deleteAt": -1,
        "extend": {},
        "id": null,
        "isSysTemplate": null,
        "name": "openapi_test",
        "status": -1,
        "testData": "W10=\n",
        "updateAt": 1678026470,
        "updator": "xxxx",
        "uuid": "pl_xxxx32",
        "workspaceUUID": "wksp_xxxx32"
    },
    "errorCode": "",
    "message": "",
    "success": true,
    "traceId": "TRACE-74509B6F-DE3D-4905-AC9F-4FD96ED78EC3"
} 

Feedback

Is this page helpful? ×