You can use shippers (Beats) to collect data, such as log files, network data, and server metrics, from your ECS instances. You can send the collected data to an Alibaba Cloud Elasticsearch or Logstash instance for monitoring and analysis. This topic uses Filebeat as an example to show you how to collect ECS service logs.
Prerequisites
Before you begin, ensure you have completed the following:
Create an Alibaba Cloud Elasticsearch instance or a Logstash instance. This topic uses version 6.7.0 as an example.
For more information, see Create an Alibaba Cloud Elasticsearch instance and Create an Alibaba Cloud Logstash instance.
Enable auto indexing for the Elasticsearch instance.
For security reasons, Alibaba Cloud Elasticsearch disables auto indexing by default. However, Beats requires this feature to collect ECS service logs. If you select Elasticsearch as the shipper output, you must enable auto indexing. For more information, see Configure YML parameters.
Create an ECS instance in the same VPC as your Alibaba Cloud Elasticsearch or Logstash instance.
When you create the instance, select one of the following operating systems: Alibaba Cloud Linux (Alinux), Red Hat Enterprise Linux (RHEL), or CentOS. Beats supports only these three operating systems. For more information, see Create an instance by using the wizard.
ImportantThe default installation directory for Beats is /opt/aliyunbeats/. After installation, the process creates three directories on the ECS instance: conf, logs, and data. These directories map to the configuration file, Beats log files, and Beats data files, respectively. To prevent errors or data inconsistencies, do not delete or modify the contents of these directories. If an issue occurs, you can check the Beats logs in the logs directory for troubleshooting.
Install Cloud Assistant and Docker on the target ECS instance.
For more information, see Install the Cloud Assistant agent and Deploy and use Docker.
ImportantYou must use Docker Community Edition (docker-ce). If you use other versions, such as podman-docker, the Beats deployment will fail.
Procedure
Log on to the Alibaba Cloud Elasticsearch console.
Navigate to the Beats Data Shippers page.
In the top navigation bar, select a region.
In the left-side navigation pane, click Beats Data Shippers.
Optional: If this is the first time you go to the Beats Data Shippers page, view the information displayed in the message that appears and click OK to authorize the system to create a service-linked role for your account.
NoteWhen Beats collects data from various data sources, Beats depends on the service-linked role and the rules specified for the role. Do not delete the service-linked role. Otherwise, the use of Beats is affected. For more information, see Alibaba Cloud ES service-linked roles.
Configure and start collecting ECS service logs.
NoteThe following steps use Filebeat as an example.
In the Create Shipper section, hover over Filebeat and click ECS Logs.
NoteFor other types of shippers, such as Metricbeat, you can click the shipper name directly.
In the Configure Shipper wizard, enter or select the shipper information.

Parameter
Description
Shipper Name
Enter a custom name for the shipper. The name must be 1–30 characters, start with a letter, and contain only letters, digits, underscores (_), and hyphens (-).
Version
Only version 6.8.5 is supported for Filebeat.
Output
The destination for data from Filebeat. Select an existing Alibaba Cloud Elasticsearch or Logstash instance. The access protocol must match the protocol of the selected Elasticsearch instance.
ImportantElasticsearch instances of version 8.x or later are not supported.
Username and Password
If you select Output as the Elasticsearch, you must provide the corresponding username and password to allow Filebeat to write data to the Elasticsearch instance. The default username is elastic. You set the password when you created the instance. If you have forgotten the password, you can reset it. For more information, see Reset the access password of an instance.
Enable Kibana Monitoring
Enables monitoring for Filebeat metrics. If you select Output as the Elasticsearch, monitoring uses the same Alibaba Cloud Elasticsearch instance as the Output by default. If you select Output as the Logstash, you must add configuration to the configuration file.
Enable Kibana Dashboard
Configures the default Kibana dashboard. Because Alibaba Cloud Kibana is deployed in a VPC, you must enable private network access for Kibana on its configuration page. For more information, see Log on to the Kibana console.
Filebeat File Path
Since Alibaba Cloud uses Docker to deploy Beats, you must map the host directories for log collection into the Docker container. The path you enter here must be a parent directory of the paths specified in the
filebeat.ymlfile'sinput.pathparameter. Wildcards (*) are not allowed in this field. For example, ifinput.path: /var/log/*/*.logis set, the Filebeat file directory can be/var/or/var/log/.ImportantThe path can be a directory or a full path. You can also use glob patterns to match specific types of files within a path.
If you need to collect logs from multiple directories, click Add to enter another path. You must also add the new path to the paths parameter in the Shipper YML Configuration.
Shipper YML Configuration
The shipper configuration file. Use the following sample to ensure that log collection is enabled and that the directories in paths are consistent with the directories you entered for Filebeat file directories.
filebeat.inputs: - type: log enabled: true paths: - /var/log/*.logFor other parameters, modify the configuration based on your business requirements. For more information, see Shipper YML configuration.
ImportantAfter you specify the Output, you do not need to configure it again in the Shipper YML Configuration. Doing so will cause an installation error.
Alibaba Cloud Filebeat does not support custom index names. By default, it creates an index with the name filebeat-%{[agent.version]}-%{+yyyy.MM.dd}, for example, filebeat-6.8.5-2021.12.11.
Click Next.
Optional: If this is your first time in the Install Shipper wizard, click Authorize Now. On the Cloud Resource Access Authorization page, click Authorize to grant the Elasticsearch instance permissions to access ECS.

The authorization service is provided by Resource Access Management (RAM). After you grant authorization, the system automatically creates two service-linked roles: AliyunElasticsearchAccessingOOSRole and AliyunOOSAccessingECS4ESRole. The default system policies attached are AliyunElasticsearchAccessingOOSRolePolicy and AliyunOOSAccessingECS4ESRolePolicy, respectively. Do not delete these system roles or policies.
If you delete a default policy or system role from the RAM console, you can re-grant the permissions by using Cloud Resource Access Authorization. You must also grant the RAM user the following custom permissions to avoid permission errors. For instructions on how to create a custom policy, see Create a custom policy.
{ "Version": "1", "Statement": [ { "Effect": "Allow", "Action": [ "ram:CreateRole", "ram:AttachPolicyToRole", "ram:GetRole" ], "Resource": "acs:ram:*:*:role/*", "Condition": { "ForAllValues:StringEquals": { "ram:TrustedPrincipalTypes": "Service", "ram:ServiceNames": [ "elasticsearch.aliyuncs.com", "oos.aliyuncs.com" ] } } }, { "Effect": "Allow", "Action": "ram:AttachPolicyToRole", "Resource": "acs:ram:*:*:policy/*" }, { "Action": "ram:PassRole", "Resource": "*", "Effect": "Allow", "Condition": { "StringEquals": { "acs:Service": "elasticsearch.aliyuncs.com" } } } ] }
In the Install Shipper wizard, select the target ECS instances.
NoteThe instance list displays all ECS instances under your account that are in the same VPC as the Elasticsearch or Logstash instance selected for the Output. You can install the shipper only on ECS instances that have both Cloud Assistant and Docker installed.
Click Start.
In the Start Shipper dialog box, click Back to Beats Shippers. View the newly created shipper in the shipper list.
Wait for the Shipper Status to change to Enabled, which indicates that the shipper is ready. The two numbers after Enabled represent the number of successful ECS installations and the total number of target ECS instances. If the installation succeeds on all instances, the two numbers will match.
View running instances.
After creating the shipper, you can view its running instances to check the installation status and troubleshoot exceptions.
In the Manage Shippers section, find the shipper and click View Instances in the Actions column.
On the View Instances page, check the Installed Shippers.
The Installed Shippers can be one of the following: Normal Heartbeat, No Heartbeat, or Installation Failed. If the status is No Heartbeat or Installation Failed, you can remove the problematic node or retry the installation. If the retry fails, see Troubleshoot Beats installation failures.
Optional: View the monitoring page or dashboard.
If you selected Enable Kibana Monitoring or Enable Kibana Dashboard when creating the shipper, you can view the monitoring information or dashboard in Kibana after the shipper starts.
In the Manage Shippers section, find the shipper, click the .
On the Kibana logon page, enter your username and password, and click Log in.
In the left-side navigation pane, click Dashboard. Then, click a metric to view its dashboard.
In the left-side navigation pane, click Monitoring. Then, click a monitoring item to view its information.
Related documentation
API operation for creating a shipper (referred to as a collector in the API): CreateCollector
FAQ
How do I use Beats to collect logs from multiple directories?
When you configure the shipper, click Add, enter the path in the text box, and add the path to the paths parameter in the Shipper YML Configuration.

What do I do if the Beats installation on an ECS instance fails?
For troubleshooting information, see Troubleshoot Beats installation failures.
> Actions > View Dashboards