CreateCollector

Updated at:

Creates a collector to collect data from a specified service.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

elasticsearch:CreateCollector

create

*All Resource

*

None None

Request syntax

POST /openapi/collectors HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

clientToken

string

No

The client token that is used to ensure the idempotence of the request. The value is generated by the client and must be unique among different requests. The token can contain a maximum of 64 ASCII characters.

5A2CFF0E-5718-45B5-9D4D-70B3FF****

body

object

No

The request body parameters that specify the configuration information for the collector to be created.

{ "dryRun": false, "name": "test_beats_1", "resType": "fileBeat", "resVersion": "6.8.5_with_community", "vpcId": "vpc-bp12nu14urf0upaf*****", "collectorPaths": [ "/var/log" ], "configs": [ { "fileName": "filebeat.yml", "content": "filebeat.inputs:xxx" } ] }

dryRun

boolean

Yes

Specifies whether to perform a dry run. This parameter is used only when you create or update a collector. Valid values:

  • true: only verifies the request without creating or updating the collector.

  • false: verifies the request and creates or updates the collector.

true

name

string

Yes

The name of the collector. The name must be 1 to 30 characters in length, and must start with a letter. It can contain letters, digits, underscores (_), and hyphens (-).

ct-test

resType

string

Yes

The type of the collector. Valid values: fileBeat, metricBeat, heartBeat, and auditBeat.

Valid values:

  • fileBeat :

    Filebeat collector.

  • auditBeat :

    Auditbeat collector.

  • metricBeat :

    Metricbeat collector.

  • heartBeat :

    Heartbeat collector.

fileBeat

vpcId

string

Yes

The ID of the virtual private cloud (VPC) where the collector resides.

vpc-bp12nu14urf0upaf*****

resVersion

string

Yes

The version of the collector. Valid values:

  • 6.8.5_with_community: deployed on ECS.

  • 6.8.13_with_community: deployed on ACK.

Valid values:

  • 6.8.13_with_community :

    ACK deployment version.

  • 6.8.5_with_community :

    ECS deployment version.

6.8.5_with_community

collectorPaths

array

No

The collection paths for Filebeat. This parameter is required only when the collector is installed on ECS instances.

string

No

The collection paths for Filebeat. This parameter is required only when the collector is installed on ECS instances.

["/var/log"]

configs

array<object>

Yes

The configuration file information of the collector.

object

Yes

The configuration file information of the collector.

fileName

string

Yes

The name of the file.

filebeat.yml

content

string

Yes

The content of the file. For more information, see https://help.aliyun.com/document_detail/146447.html.

"filebeat.inputs:xxx"

extendConfigs

array<object>

Yes

The extended configuration of the collector.

object

Yes

The extended configuration of the collector. For more information, see the extendConfigs parameter description section below.

{"instanceId":"es-cn-nif201ihd0012****","instanceType":"elasticsearch","configType":"collectorTargetInstance","hosts":["es-cn-nif201ihd0012****.elasticsearch.aliyuncs.com:9200"],"userName":"elastic","password":"*****","protocol":"HTTP"}

extendConfigs parameter description

The parameters in extendConfigs are described as follows.

NameTypeRequiredExampleDescription
extendConfigsArrayThe extended configuration of the collector.
└configTypeStringYescollectorElasticsearchForKibanaThe configuration type. Valid values: collectorTargetInstance (the output instance of the collector), collectorDeployMachine (the machine on which the collector is deployed), and collectorElasticsearchForKibana (the information about the Elasticsearch instance that supports Kibana dashboards).
└typeStringNoECSInstanceIdThe type of the machine on which the collector is deployed. Valid values: ECSInstanceId (ECS) and ACKCluster (ACK cluster). This parameter is required when configType is set to collectorDeployMachine.
└instanceTypeStringNoelasticsearchThe type of the output instance specified for the collector. Valid values: elasticsearch and logstash. This parameter is required when configType is set to collectorTargetInstance.
└instanceIdStringYeses-cn-nif201ihd0012****Instance ID of the instance associated with the collector. When configType is set to collectorTargetInstance, this parameter specifies instance ID of the output instance of the collector. When configType is set to collectorDeployMachines and type is set to ACKCluster, this parameter specifies instance ID of the ACK cluster.
└machinesArrayNoThe information about the ECS instances on which the collector is deployed. This parameter is required when configType is set to collectorDeployMachines and type is set to ECSInstanceId.
└└instanceIdStringYesi-bp11u91xgubypcuz****Instance IDs of the ECS instances.
└groupIdStringdefault_ct-cn-5i2l75bz4776****Instance ID of the machine group. This parameter is required when configType is set to collectorDeployMachine.
└protocolStringNoHTTPThe transmission protocol, which must be consistent with the access protocol of the output instance specified for the collector. Valid values: HTTP and HTTPS. This parameter is required when configType is set to collectorTargetInstance.
└userNameStringNoelasticThe username used to access the output instance specified for the collector. Default value: elastic. This parameter is required when configType is set to collectorTargetInstance or collectorElasticsearchForKibana.
└passwordStringNo*****The password of the username.
└enableMonitoringBooleanNotrueSpecifies whether to enable Monitoring. This parameter is required when configType is set to collectorTargetInstance and instanceType is set to elasticsearch. Valid values: true (enables Monitoring) and false (does not enable Monitoring).
└hostsListNo["es-cn-nif201i*****.elasticsearch.aliyuncs.com:9200"]The list of access addresses of the output instance specified for the collector. This parameter is required when configType is set to collectorTargetInstance.
└hostStringNoes-cn-nif201ihd0012****-kibana.internal.elasticsearch.aliyuncs.com:5601The private network access address of Kibana after Kibana Dashboard is enabled. This parameter is required when configType is set to collectorElasticsearchForKibana.
└kibanaHostStringNohttps://es-cn-nif201ihd0012****.kibana.elasticsearch.aliyuncs.com:5601The public network access address of Kibana after Kibana Dashboard is enabled. This parameter is required when configType is set to collectorElasticsearchForKibana.
Note

└ indicates a child parameter.

extendConfigs includes three configType values: collectorTargetInstance, collectorElasticsearchForKibana, and collectorDeployMachine. The parameters to be configured vary based on the deployment machine. The specific combinations are as follows:

  • collectorTargetInstance

    • ECS configType, instanceId, instanceType, hosts, userName, password, protocol, and enableMonitoring

    • ACK configType, instanceId, instanceType, userName, password, protocol, and enableMonitoring

  • collectorElasticsearchForKibana

    • ECS configType, instanceId, host, kibanaHost, userName, password, and protocol

    • ACK configType

  • collectorDeployMachine

    • ECS configType, type, machines, and groupId

    • ACK configType, type, and instanceId

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID.

8466BDFB-C513-4B8D-B4E3-5AB256AB****

Result

object

The returned result.

resId

string

The ID of the created collector.

ct-cn-4135is2tj194p****

Examples

Success response

JSON format

{
  "RequestId": "8466BDFB-C513-4B8D-B4E3-5AB256AB****",
  "Result": {
    "resId": "ct-cn-4135is2tj194p****"
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.