修改¶
POST /api/v1/pipeline/{pl_uuid}/modify
概述¶
整体修改Pipeline配置并保留历史。
调用前和使用步骤¶
先读取详情备份,带当前configVersion和完整可写字段提交。此入口整体替换:source、extend、asDefault、enableByLogBackup、testData、dataType省略会变为空数组/对象、0、空串、line_protocol等默认;保留原status。真实配置变化才归档原版本并递增,完全相同保存不建新版本。modify响应source仅为关系更新差异摘要,可能含被移除来源并漏保留交集,不可用其代替再次get的最终source。
默认冲突先返回HTTP200且content.confirm非空,无正常实体;人工确认后才用同一配置isForce=true重试。强制替换也会把原默认降为非默认并归档它。
保存同步校验语法并更新配置/版本,实际采集或中心处理生效取决于后续配置获取及数据流;不重跑历史数据,不返回解析样本结果。修改前备份详情,报错/超时后先读回当前版本再重试。
路由参数¶
| 参数名 | 类型 | 必选 | 说明 |
|---|---|---|---|
| pl_uuid | string | Y | 当前空间Pipeline UUID,区别历史UUID、名称或数字id。 例子: pl_example获取或填写方式: 从Pipeline列表取uuid。 |
请求头¶
| 参数名 | 类型 | 必选 | 说明 |
|---|---|---|---|
| DF-API-KEY | string | Y | 工作空间的 OpenAPI 鉴权凭据。 例子: <DF-API-KEY>获取或填写方式: 从目标工作空间的 API Key 管理获取有该操作权限的 OpenAPI Key。 |
Body 请求参数¶
| 参数名 | 类型 | 必选 | 说明 |
|---|---|---|---|
| source[*] | string | 建议非空字符串,数组未逐项严格校验;不要混不相关数据域。 例子: nginx获取或填写方式: 单个真实来源标识,或采集侧支持的通配模式。 |
|
| extend.appID[*] | string | 建议非空字符串。 例子: appid_example获取或填写方式: 从应用配置取得单个appId。 |
|
| extend.measurement[*] | string | 建议非空字符串。 例子: view获取或填写方式: 真实measurement原始名称。 |
|
| name | string | Y | 必填,最大256计数单位(ASCII/半角片假名1,其他字符2),允许字母数字下划线中文U+4e00..9fa5及短横线;建议非空。相同category不允许重复,即使local/central不同或旧项禁用。不是输入日志source。 允许 null: False 最大长度: 256 $notSearchRegExp: [^a-zA-Z0-9_\u4e00-\u9fa5-]+ 例子: production_parser获取或填写方式: 业务自定义文件名,先从Pipeline列表检查同类别非删除名称。 |
| type | string | Y | 必填local/central;拨测dialtesting新增/修改只能central。空间版本可限制central。修改会替换原运行类型。 允许 null: False 可选值: ['local', 'central'] 例子: local获取或填写方式: 本地采集器处理选local,平台中心处理选central,核对实际数据入口。 |
| source | array | 可选默认[],修改省略会移除全部来源关系。包含*或?的来源不参加精确唯一性冲突检查,不保证所有匹配运行时行为;普通精确来源在相同category/type内不可被其他非删除Pipeline占用。rum/llm新增修改忽略此数组,改用extend.appID与measurement。 允许 null: False 例子: ["nginx"]获取或填写方式: 从对应采集数据的source或来源选择器取值,不是Pipeline名称;日志可参考真实日志source。 |
|
| content | string | Y | 必填base64字符串,新增解码后非空。解码脚本全文同时满足UI字符计数≤1048576和UTF8字节≤1048576;BMP非ASCII计2,补充字符计4。任一超限均ft.ContextExceedLimit。保存会同步无样本编译并检查同类别启用脚本引用,成功不等于真实数据调试通过或已生效。 允许 null: False 例子: YWRkX2tleSgiZW52IiwgInByb2R1Y3Rpb24iKQ==获取或填写方式: 先写UTF8 Pipeline脚本,再做标准base64编码;示例解码为 add_key("env", "production")。 |
| testData | string | 声明可选,但新增省略后controller解码None可返回InvalidBase64,应始终显式给W10=或空串。修改省略恢复空串。公开add/modify只接受空串,或严格base64解码后为空/JSON数组,不能直接编码单个对象。数组成员建议字符串或对象,数值/null可能在历史逐项长度校验导致500;每项历史限制约20480(对象按序列化对象内存大小、字符串按历史加权长度),不是脚本1MiB上限。 允许 null: False 允许空字符串: True 例子: W3sibWVzc2FnZSI6ImV4YW1wbGUgbG9nIn1d获取或填写方式: 先把样例数组序列化JSON,再UTF8编码并base64;空数组[]为W10=。 |
|
| dataType | string | 可选,默认line_protocol;支持line_protocol/json/message。修改省略恢复line_protocol;不是category。空字符串虽声明兼容,应明确选受支持值。 允许 null: False 允许空字符串: True 可选值: ['line_protocol', 'json', 'message'] 例子: json获取或填写方式: 按testData样例与脚本输入选择。 |
|
| isForce | boolean | 可选默认false。仅默认冲突确认,不能跳过语法、来源、名称、版本等校验;强制替换将原默认改非默认并归档其版本。 允许 null: False 例子: false获取或填写方式: 收到content.confirm后,确认替换原默认Pipeline再设true。 |
|
| configVersion | integer | 修改可选但强烈建议传入≥1整数,恢复历史必填当前版本;不是目标历史版本。与当前不符返回HTTP409,重新读取、合并变更后再提交。 允许 null: False $minValue: 1 例子: 1获取或填写方式: 从当前详情content.configVersion或历史首屏currentPipelineInfo.configVersion取得。 |
|
| asDefault | int | 可选默认0,建议只给0/1;已有默认且未isForce时HTTP200返回confirm数组,本次目标配置未保存,不当作创建/修改成功。 允许 null: False 例子: 0获取或填写方式: 希望作为同category/type的兜底规则时1,否则0。 |
|
| enableByLogBackup | int | 可选默认0,建议0/1。保存标志不保证已有转发数据自动重跑。 允许 null: False 例子: 0获取或填写方式: 需要规则处理转发数据时1;从实际数据转发链确认支持。 |
|
| category | string | Y | 必填lineage/logging/object/custom_object/network/tracing/rum/llm/agent_monitor/security/keyevent/metric/profiling/dialtesting/cloud_billing;billing为历史兼容值。修改可变更类别,需要一起校对脚本、source和extend。 允许 null: False 允许空字符串: False 可选值: ['lineage', 'logging', 'object', 'custom_object', 'network', 'tracing', 'rum', 'llm', 'agent_monitor', 'security', 'keyevent', 'metric', 'profiling', 'dialtesting', 'billing', 'cloud_billing', 'keyevent'] 例子: logging获取或填写方式: 按目标数据域及采集配置选择。 |
| extend | json | 可选默认{};修改整体替换,不合并。rum/llm使用appID×measurement组合生成来源关系;未知子字段会被公开校验拒绝。 允许 null: False 例子: {"loggingIndex": "default"}获取或填写方式: 根据类别及已有详情组织下列声明字段。 |
|
| extend.appID | array | rum/llm应与measurement同时提供非空数组;两者都空可无专属来源,有appID无measurement报缺少参数。 允许 null: True 例子: ["appid_example"]获取或填写方式: 从相应RUM/LLM应用管理取得真实appId。 |
|
| extend.measurement | array | rum/llm与appID做笛卡尔组合;有measurement却没有appID报缺少参数,保存不验证每个应用/measurement确有数据。 允许 null: True 例子: ["view"]获取或填写方式: 从该应用真实数据的measurement取得,如RUM view/action等,按实际类别填写。 |
|
| extend.loggingIndex | string | 可选日志索引回显字段,默认不补值,修改省略随extend清除;不是source数组。 允许 null: True 例子: default获取或填写方式: 从日志索引列表取得适用索引标识。 |
|
| extend.ifAiCreate | boolean | 可选回显,不触发AI任务。 允许 null: True 例子: false获取或填写方式: 记录是否由AI辅助生成,不需此标记可省略。 |
|
| extend.aiTargetStructure | string | 可选字符串,仅保存回显;本接口不生成脚本。 允许空字符串: True 允许 null: True 例子: 获取或填写方式: AI生成时的目标结构说明,不需要可省略。 |
|
| extend.exampleSource | string | 可选回显,不代替source关联。 允许空字符串: True 允许 null: True 例子: nginx获取或填写方式: 样例来源展示值,需与真实source对应。 |
|
| extend.exampleType | string | 可选回显字符串,服务端未给固定枚举。 允许空字符串: True 允许 null: True 例子: custom获取或填写方式: 样例类型展示值,由客户端业务定义。 |
参数补充说明¶
并发修改保护¶
建议先调用 /api/v1/pipeline/<pl_uuid>/get 读取当前配置和 configVersion,再以现有修改参数加 configVersion 提交。本接口并非只提交 configVersion 的局部更新接口,name、type、category、content 等必填参数仍需按契约提供。
configVersion 为可选正整数;不传兼容旧调用,但不启用版本号冲突检查。版本一致且配置实际变化时,归档旧配置并返回新的配置版本;相同配置重复保存不生成版本。收到 409 / ft.PipelineConfigVersionConflict 时,应重新读取并比较配置,确认后再提交,不能自动覆盖他人修改。
示例请求体:{"name":"demo","type":"local","category":"logging","content":"YWRkX2tleShjaXR5LCAic2hhbmdoYWkiKQ==","testData":"W10=","source":["nginx"],"configVersion":3}。
返回及重试¶
成功响应 content 是当前 Pipeline 对象,包含 configVersion、configVersionAt、configVersionOperator、configVersionSource、configVersionAction、configVersionSourceInfo。时间为 Unix 秒级时间戳。若 content 为 {"confirm":["logging"]},表示默认替换需要确认,本次尚未完成修改;isForce 仅用于默认替换,不跳过名称/source或版本冲突校验。
content 和 testData 请求字段均为 Base64 编码。普通 OpenAPI 修改保留 testData 解码后为空或 JSON 数组的约束。超时后应先查询当前配置确认写入结果,避免无条件重复提交。
请求例子¶
curl --request POST 'https://openapi.guance.com/api/v1/pipeline/pl_example/modify' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"name":"production_parser","type":"local","category":"logging","content":"YWRkX2tleSgiZW52IiwgInByb2R1Y3Rpb24iKQ==","testData":"W3sibWVzc2FnZSI6ImV4YW1wbGUgbG9nIn1d","dataType":"json","asDefault":0,"enableByLogBackup":0,"extend":{"loggingIndex":"default"},"source":["nginx"],"configVersion":1}'
响应¶
HTTP 200,application/json。下方示例展示可直接读取的主要字段。
| 字段 | 类型 | 说明 |
|---|---|---|
| content.id | integer | 数据库编号,用uuid操作。 |
| content.uuid | string | pl_对象UUID。 |
| content.workspaceUUID | string | 所属空间;系统模板为空字符串。 |
| content.isSysTemplate | string / integer / boolean | 是否系统模板,实体为Text列,可能返回字符串标记;按实际标记解析,不用字符串非空直接判断。 |
| content.isCustomSysTemp | integer 或 boolean | 是否定制系统模板。 |
| content.language | string | 模板/配置语言,可能空串。 |
| content.status | integer | 0启用、2禁用、3删除。 |
| content.creator | string | 创建身份。 |
| content.updator | string | 最近更新身份。 |
| content.createAt | integer | 创建Unix秒。 |
| content.updateAt | integer | 更新Unix秒。 |
| content.deleteAt | integer | 删除Unix秒,未删除-1。 |
| content.name | string | 保存配置:必填,最大256计数单位(ASCII/半角片假名1,其他字符2),允许字母数字下划线中文U+4e00..9fa5及短横线;建议非空。相同category不允许重复,即使local/central不同或旧项禁用。不是输入日志source。 |
| content.type | string | 保存配置:必填local/central;拨测dialtesting新增/修改只能central。空间版本可限制central。修改会替换原运行类型。 |
| content.category | string | 保存配置:必填lineage/logging/object/custom_object/network/tracing/rum/llm/agent_monitor/security/keyevent/metric/profiling/dialtesting/cloud_billing;billing为历史兼容值。修改可变更类别,需要一起校对脚本、source和extend。 |
| content.source | array | 本次来源关系更新的差异摘要,可能包含被移除来源,也可能不含仍保留的交集;不是最终来源集合,请get读回。 |
| content.source[] | string | 一个本次关系变化涉及的来源名称,不据此判断最终是否仍绑定。 |
| content.content | string | 保存配置:必填base64字符串,新增解码后非空。解码脚本全文同时满足UI字符计数≤1048576和UTF8字节≤1048576;BMP非ASCII计2,补充字符计4。任一超限均ft.ContextExceedLimit。保存会同步无样本编译并检查同类别启用脚本引用,成功不等于真实数据调试通过或已生效。 |
| content.testData | string | 保存配置:声明可选,但新增省略后controller解码None可返回InvalidBase64,应始终显式给W10=或空串。修改省略恢复空串。公开add/modify只接受空串,或严格base64解码后为空/JSON数组,不能直接编码单个对象。数组成员建议字符串或对象,数值/null可能在历史逐项长度校验导致500;每项历史限制约20480(对象按序列化对象内存大小、字符串按历史加权长度),不是脚本1MiB上限。 |
| content.dataType | string | 保存配置:可选,默认line_protocol;支持line_protocol/json/message。修改省略恢复line_protocol;不是category。空字符串虽声明兼容,应明确选受支持值。 |
| content.asDefault | integer | 保存配置:可选默认0,建议只给0/1;已有默认且未isForce时HTTP200返回confirm数组,本次目标配置未保存,不当作创建/修改成功。 |
| content.enableByLogBackup | integer | 保存配置:可选默认0,建议0/1。保存标志不保证已有转发数据自动重跑。 |
| content.extend | json | 保存配置:可选默认{};修改整体替换,不合并。rum/llm使用appID×measurement组合生成来源关系;未知子字段会被公开校验拒绝。 |
| content.extend.appID | array | 保存配置:rum/llm应与measurement同时提供非空数组;两者都空可无专属来源,有appID无measurement报缺少参数。 |
| content.extend.measurement | array | 保存配置:rum/llm与appID做笛卡尔组合;有measurement却没有appID报缺少参数,保存不验证每个应用/measurement确有数据。 |
| content.extend.loggingIndex | string | 保存配置:可选日志索引回显字段,默认不补值,修改省略随extend清除;不是source数组。 |
| content.extend.ifAiCreate | boolean | 保存配置:可选回显,不触发AI任务。 |
| content.extend.aiTargetStructure | string | 保存配置:可选字符串,仅保存回显;本接口不生成脚本。 |
| content.extend.exampleSource | string | 保存配置:可选回显,不代替source关联。 |
| content.extend.exampleType | string | 保存配置:可选回显字符串,服务端未给固定枚举。 |
| content.extend.appID[] | string | 保存配置:建议非空字符串。 |
| content.extend.measurement[] | string | 保存配置:建议非空字符串。 |
| content.configVersion | integer | 当前配置版本,初始1;配置发生实际变化时递增,启停不是配置快照字段。 |
| content.configVersionAt | integer | 该配置版本生效记录时间,Unix秒。 |
| content.configVersionOperator | string | 该版本操作者身份。 |
| content.configVersionSource | string | 来源如openapi/console/history/workspace_restore/legacy/system。 |
| content.configVersionAction | string | 如create/modify/import/official_clone/current_clone/history_restore/history_clone/default_replace/baseline。 |
| content.configVersionSourceInfo | object | 来源动作资料,无来源时{},字段按动作可省略。 |
| content.configVersionSourceInfo.templateName | string | 官方克隆来源模板名称。 |
| content.configVersionSourceInfo.pipelineUUID | string | 来源Pipeline UUID。 |
| content.configVersionSourceInfo.configVersion | integer | 来源配置版本号。 |
| content.configVersionSourceInfo.pipelineHistoryUUID | string | 历史克隆/恢复来源历史UUID。 |
| content.configVersionSourceInfo.replacedByName | string | 默认替换触发的新文件名。 |
| content.configVersionSourceInfo.replacedByPipelineUUID | string | 默认替换触发的Pipeline UUID。 |
| content.declaration | object 或 null | 非空业务对象附带的工作空间公共声明,未配置时可为null或空对象;空对象不添加。 |
| content.confirm | array<string> |
默认冲突时替代正常实体,列出需确认替换的类别;此分支未保存本次目标。 |
| content.confirm[] | string | 单个类别。 |
| content.pl_errors | array<object> |
仅ft.PipelineSyntaxError错误content中返回的编译错误数组。 |
| content.pl_errors[].error | string | 编译错误说明。 |
| content.pl_errors[].pos_chain | array<object> |
引用/位置链。 |
| content.pl_errors[].pos_chain[].file | string | 文件名。 |
| content.pl_errors[].pos_chain[].ln | integer | 非负位置索引,由编译器定义;保留原值排查。 |
| content.pl_errors[].pos_chain[].col | integer | 非负位置索引,由编译器定义;保留原值排查。 |
| content.pl_errors[].pos_chain[].pos | integer | 非负位置索引,由编译器定义;保留原值排查。 |
{
"code": 200,
"content": {
"id": 100,
"uuid": "pl_example",
"workspaceUUID": "wksp_example",
"name": "production_parser",
"type": "local",
"category": "logging",
"content": "YWRkX2tleSgiZW52IiwgInByb2R1Y3Rpb24iKQ==",
"testData": "W3sibWVzc2FnZSI6ImV4YW1wbGUgbG9nIn1d",
"dataType": "json",
"asDefault": 0,
"enableByLogBackup": 0,
"extend": {
"loggingIndex": "default"
},
"isSysTemplate": 0,
"isCustomSysTemp": 0,
"language": "",
"status": 0,
"creator": "wsak_example",
"updator": "wsak_example",
"createAt": 1785427200,
"updateAt": 1785427200,
"deleteAt": -1,
"configVersion": 2,
"configVersionAt": 1785427200,
"configVersionOperator": "wsak_example",
"configVersionSource": "openapi",
"configVersionAction": "modify",
"configVersionSourceInfo": {},
"source": [
"nginx"
],
"declaration": {}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
默认替换待确认:
{
"code": 200,
"content": {
"confirm": [
"logging"
],
"declaration": {}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
错误响应¶
鉴权、限流和公共请求错误参见公共错误定义。
| HTTP 状态 | errorCode | 触发条件 | 消息或响应说明 | 处理方式 |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | 请求字段缺失,或字段值违反声明的校验条件 | 参数解析失败 | 核对参数位置、字段名、类型和取值。 |
| 400 | ft.RequestJsonFormatError | 请求 JSON 语法无效 | 请求 JSON 格式错误 | 按 content.reason、line、column 修正 JSON。 |
| 406 | ft.InvalidBase64 | 本次提交的content或testData不是可解码的Base64内容 | 无效的base64内容 | 完整提供content和testData,先UTF8再base64。 |
| 406 | ft.ContextExceedLimit | 脚本超过UI字符计数或UTF8字节1MiB,或add/modify单条测试样例超历史长度 | 文本内容超限制,限制{}个字符 | 缩减脚本/单条样例,查看message标明的单位。 |
| 406 | ft.PipelineSyntaxError | 同步无样本编译返回脚本或引用语法错误 | Pipeline脚本语法错误,请检查错误位置 | 按content.pl_errors的error及pos_chain定位修正,再重试。 |
| 400 | ft.PipelineNameExists | 同空间同category存在非删除同名脚本 | 已存在同名的Pipeline | 更换名称,或更新原UUID。 |
| 400 | ft.PipelineSourceExists | 同category/type已有非删除规则占用同一精确source | 该类型Pipeline的source来源已经存在 | 核对来源绑定,改用合适来源;通配项不会参加该检查。 |
| 403 | ft.ForbiddenFreeEditionWorkspace | 空间版本的Pipeline运行类型限制不允许该type | 免费版工作空间不支持该功能。可开通商业版解锁限制 | 由管理员确认空间版本及支持运行方式。 |
| 500 | ft.InternalServerError | 同步编译服务不可用/超时/格式异常(内部PipelineValidationUnavailable最终被统一包装),数据库、结构错误或提交后格式化失败 | 内部错误 | 稍后重试前先读取当前配置和版本,确认是否已经保存;持续失败提供traceId。 |
| 406 | ft.DialingPipelineOnlyCentral | dialtesting选择local | 可用性拨测 pipeline 只支持 中心 pipeline 配置 | 改用受支持central且确认空间版本。 |
| 406 | ft.MissingNeededParmeterAppID | rum/llm的appID与measurement只提供一侧 | 需要指定appID | 两者同时提供,或同时留空;修改与新增错误键存在历史兼容差异。 |
| 404 | ft.NotFoundPipelineCfg | 本空间要修改的当前Pipeline不存在或已删除 | 未找到指定的Pipeline配置 | 刷新对应系统模板或当前空间Pipeline列表,取得本操作的准确目标和来源标识。 |
| 409 | ft.PipelineConfigVersionConflict | 提交的configVersion与当前不符 | Pipeline 配置已被更新,请刷新后重试 | 重新获取最新版本并合并变更。 |
| 406 | ft.InvalidPipelineTestData | 公开testData解码不是JSON数组 | 无效的pipeline testData,base64解码后必须为空或JSON数组 | 使用数组或空串。 |