请求参数
以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见
公共请求参数。
Action
|
String
|
是
| 公共参数,本接口取值:CreateLogRule。 |
Version
|
String
|
是
| 公共参数,本接口取值:2019-08-06。 |
ClusterId
|
String
|
是
| |
RuleName
|
String
|
是
| 日志规则名称
- 不超过40个字符,只能包含小写字母、数字及分隔符("-"、"_"、"."),且必须以小写字母、数字开头和结尾
|
InputConfig
|
Object
|
是
| |
InputType
|
Int
|
否
| 日志类型
- 1:容器标准输出
- 2:容器文件路径
- 3:主机文件路径
|
ContainerStandout
|
Object
|
否
| |
AllContainer
|
Boolean
|
否
| |
SpecifiedWorkload
|
Object
|
否
| 指定负载采集
- 如果 AllContainer 为false,SpecifiedWorkload 或 SpecifiedPodLabel 必须指定一项
|
NamespaceList.N
|
Object
|
否
| |
NamespaceName
|
String
|
否
| |
AllContainer
|
Boolean
|
否
| |
Workload.N
|
Object
|
否
| 采集负载集合
- 如果 AllContainer=false,则此项为必填
|
WorkloadType
|
String
|
否
| 负载类型
- Deployment
- DaemonSet
- StatefulSet
- Job
|
WorkloadName
|
String
|
否
| |
SpecifiedPodLabel
|
Object
|
否
| 指定PodLable采集
- 如果 AllContainer 为false,SpecifiedWorkload 或 SpecifiedPodLabel 必须指定一项
|
NamespaceOperator
|
Int
|
否
| |
Namespace.N
|
String
|
否
| 命名空间集合,如果NamespaceOperator=2,该项为必填
|
ContainerNameOperator
|
Int
|
否
| 容器名称操作类型,如果ContainerName不为空,则该值为必填项。有效值:1、2
|
ContainerName
|
String
|
否
| |
ContainerLabel.N
|
Object
|
否
| |
Key
|
String
|
否
| 标签键,如果ContainerLabel不为空,则该值必填
|
Value
|
String
|
否
| 标签值,如果ContainerLabel不为空,则该值必填
|
Operator
|
Int
|
否
| 标签操作类型,有效值 1、2
- 1:key 等于 value
- 2:key 不等于 value
|
ContainerFile
|
Object
|
否
| 容器文件路径,如果 InputType=2,则该项必填
|
SpecifiedContainer
|
Object
|
否
| |
Namespace
|
String
|
否
| 所属命名空间,如果 SpecifiedPodLabel 不为空,则该项必填
|
WorkloadType
|
String
|
否
| 负载类型
- Deployment
- DaemonSet
- StatefulSet
- Job
|
WorkloadName
|
String
|
否
| |
ContainerName
|
String
|
否
| |
ContainerPath
|
String
|
否
| 设置要采集的日志文件的绝对路径,不支持通配符“*”
|
SpecifiedPodLabel
|
Object
|
否
| |
NamespaceOperator
|
Int
|
否
| |
Namespace.N
|
String
|
否
| |
ContainerNameOperator
|
Int
|
否
| |
ContainerName
|
String
|
否
| |
ContainerPath.N
|
String
|
否
| 设置要采集的日志文件的绝对路径,不支持通配符“*”
|
ContainerLabel.N
|
Object
|
否
| |
Key
|
String
|
否
| |
Value
|
String
|
否
| |
Operator
|
Int
|
否
| 标签操作类型,有效值 1、2
- 1:key 等于 value
- 2:key 不等于 value
|
HostFile
|
Object
|
否
| 主机文件路径,如果 InputType=3,则该项必填
|
Path
|
String
|
否
| 设置要采集的日志文件的绝对路径,不支持通配符“*”
|
Label.N
|
Object
|
否
| |
Value
|
String
|
否
| |
Key
|
String
|
否
| |
OutputConfig
|
Object
|
是
| |
Klog
|
Object
|
是
| |
ProjectName
|
String
|
是
| |
PoolName
|
String
|
是
| |
返回参数
RequestId
|
String
| 示例值:f297fa74-1932-4901-bdc5-8c5d09f9b313 |
请求示例
curl -X GET|POST
'http://kce.api.ksyun.com/?Action=CreateLogRule&Version=2019-08-06'
-H 'authorization: xxx, SignedHeaders=content-type;host;x-amz-date, Signature=xxx'
-H 'cache-control: no-cache'
-H 'content-type: application/x-www-form-urlencoded'
-H 'host: kce.api.ksyun.com'
-H 'x-amz-date: 20170720T022802Z'
-d 'ClusterId=xxx&RuleName=xxx&InputConfig.InputType=xxx&InputConfig.ContainerStandout.AllContainer=xxx&InputConfig.ContainerStandout.SpecifiedWorkload.NamespaceList.N.NamespaceName=xxx&InputConfig.ContainerStandout.SpecifiedWorkload.NamespaceList.N.AllContainer=xxx&InputConfig.ContainerStandout.SpecifiedWorkload.NamespaceList.N.Workload.N.WorkloadType=xxx&InputConfig.ContainerStandout.SpecifiedWorkload.NamespaceList.N.Workload.N.WorkloadName=xxx&InputConfig.ContainerStandout.SpecifiedPodLabel.NamespaceOperator=xxx&InputConfig.ContainerStandout.SpecifiedPodLabel.Namespace.N=xxx&InputConfig.ContainerStandout.SpecifiedPodLabel.ContainerNameOperator=xxx&InputConfig.ContainerStandout.SpecifiedPodLabel.ContainerName=xxx&InputConfig.ContainerStandout.SpecifiedPodLabel.ContainerLabel.N.Key=xxx&InputConfig.ContainerStandout.SpecifiedPodLabel.ContainerLabel.N.Value=xxx&InputConfig.ContainerStandout.SpecifiedPodLabel.ContainerLabel.N.Operator=xxx&InputConfig.ContainerFile.SpecifiedContainer.Namespace=xxx&InputConfig.ContainerFile.SpecifiedContainer.WorkloadType=xxx&InputConfig.ContainerFile.SpecifiedContainer.WorkloadName=xxx&InputConfig.ContainerFile.SpecifiedContainer.ContainerName=xxx&InputConfig.ContainerFile.SpecifiedContainer.ContainerPath=xxx&InputConfig.ContainerFile.SpecifiedPodLabel.NamespaceOperator=xxx&InputConfig.ContainerFile.SpecifiedPodLabel.Namespace.N=xxx&InputConfig.ContainerFile.SpecifiedPodLabel.ContainerNameOperator=xxx&InputConfig.ContainerFile.SpecifiedPodLabel.ContainerName=xxx&InputConfig.ContainerFile.SpecifiedPodLabel.ContainerPath.N=xxx&InputConfig.ContainerFile.SpecifiedPodLabel.ContainerLabel.N.Key=xxx&InputConfig.ContainerFile.SpecifiedPodLabel.ContainerLabel.N.Value=xxx&InputConfig.ContainerFile.SpecifiedPodLabel.ContainerLabel.N.Operator=xxx&InputConfig.HostFile.Path=xxx&InputConfig.HostFile.Label.N.Value=xxx&InputConfig.HostFile.Label.N.Key=xxx&OutputConfig.Klog.ProjectName=xxx&OutputConfig.Klog.PoolName=xxx'

返回示例
JSON格式
{
"RequestId":"f297fa74-1932-4901-bdc5-8c5d09f9b313" }

错误码
以下仅列出了接口业务逻辑相关的错误码,其他错误码详见公共错误码