Install, upgrade, or uninstall the Simple Log Service agent (Logtail) on multiple Elastic Compute Service (ECS) instances in a batch.
Property | Value |
Template name | ACS-ECS-BulkyInstallLogAgent |
Template type | Automated |
Owner | Alibaba Cloud |
Prerequisites
Before you begin, make sure that you have:
Target ECS instances that are running and reachable
Cloud Assistant installed and running on each target ECS instance (the template uses
ACS::ECS::RunCommandto run scripts remotely)Internal network access from the ECS instances to the regional Object Storage Service (OSS) endpoint for downloading the Logtail installer
A Resource Access Management (RAM) role with the required permissions, if you use the
OOSAssumeRoleparameter (see Required permissions)
How it works
The template performs the following steps:
Retrieve target instances -- Selects the ECS instances that match the
targetsfilter by using theACS::SelectTargetsaction. The template detects each instance's operating system type (Linux or Windows).Run OS-specific commands -- Loops over each instance and runs the appropriate script:
Linux: Downloads
logtail.shfrom the internal OSS endpoint and runs it as a shell script (RunShellScript).Windows: Downloads
logtail_installer.zipfrom the internal OSS endpoint, extracts it, and runslogtail_installer.exeas a PowerShell script (RunPowerShellScript).
Return results -- Aggregates command output from all instances into the
commandOutputoutput parameter.
Action modes
The action parameter determines the operation on each instance.
Action | Behavior |
| Installs Logtail. If Logtail is already installed and |
| Upgrades Logtail to the latest version. On Linux, runs |
| Removes Logtail from the instance. On Linux, runs |
Existing agent detection
When action is install and overwrite is false, the template checks whether Logtail is already installed by looking for the following paths:
Operating system | Path checked |
Linux |
|
Windows (64-bit) |
|
Windows (32-bit) |
|
If the path exists, the template skips the instance.
Input parameters
Parameter | Type | Required | Default | Description |
| Json | Yes | -- | The ECS instances to target. Uses the |
| String | No |
| The region where the ECS instances reside. Defaults to the region of the current OOS execution. |
| String | No |
| The operation to perform. Allowed values: |
| Boolean | No |
| Whether to overwrite the existing Logtail agent on an instance. The existing agent is not overwritten by default. Applies only when |
| Json | No |
| Controls concurrency and error threshold for the batch operation. |
| String | No |
| The RAM role that OOS assumes to run this template. Leave blank to use the permissions of the current user. |
Parameter groups
The OOS console organizes these parameters into the following groups:
Group | Parameters |
Configure Parameters |
|
Select Instances |
|
Control Options |
|
Rate control settings
The rateControl parameter is a JSON object with the following sub-parameters:
Sub-parameter | Type | Description |
| String | The concurrency mode. Set to |
| Number | The maximum number of instances that the template processes at the same time. Default: |
| Number | The maximum number of errors allowed before the template stops processing remaining instances. Default: |
Default value:
{
"Mode": "Concurrency",
"MaxErrors": 0,
"Concurrency": 10
}Output parameters
Parameter | Type | Description |
| String | The aggregated output from commands run on all target instances. |
Required permissions
Attach the following policy to the RAM role specified in OOSAssumeRole, or to the RAM user or role that runs the template.
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeInstances",
"ecs:DescribeInvocationResults",
"ecs:DescribeInvocations",
"ecs:RunCommand"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"oos:GetApplicationGroup"
],
"Resource": "*",
"Effect": "Allow"
}
]
}This policy grants the following access:
ecs:DescribeInstances -- Query instance details to resolve the
targetsfilter.ecs:RunCommand -- Run shell or PowerShell scripts on the target instances.
ecs:DescribeInvocations and ecs:DescribeInvocationResults -- Monitor command status and retrieve output.
oos:GetApplicationGroup -- Retrieve application group information when targets are specified by application group.
Cross-OS behavior
The template detects each instance's operating system and runs the corresponding installer script.
Linux
Downloads
logtail.shfromhttp://logtail-release-{regionId}.oss-{regionId}-internal.aliyuncs.com/linux64/logtail.sh.On successful installation, outputs the contents of
/usr/local/ilogtail/app_info.json.Uses shell script execution (
RunShellScript).
Windows
Downloads
logtail_installer.zipfromhttp://logtail-release-{regionId}.oss-{regionId}-internal.aliyuncs.com/win/logtail_installer.zip.Extracts files to a temporary directory (
C:\Users\Administrator\OOSPackages), runs the installer, and cleans up the temporary files.Uses PowerShell script execution (
RunPowerShellScript).On Windows,
upgradeperforms a full uninstall followed by a reinstall.
Troubleshooting
Issue | Possible cause | Solution |
| The ECS instance cannot reach the internal OSS endpoint for the specified region. | Verify that the instance has internal network access to |
| Logtail is already installed and | Set |
Command timeout or failure | Cloud Assistant may not be running on the target instance, or the instance may be stopped. | Verify that the instance is in the Running state and that Cloud Assistant is installed and running. |
Permission denied errors | The user or | Attach the RAM policy listed in Required permissions. |
Template source
For the full YAML template, see ACS-ECS-BulkyInstallLogAgent.yml on GitHub.