This topic describes how to specify the ID of an Alibaba Cloud account as a user identifier on a server.
Prerequisites
- A server is available.
The server can be an Elastic Compute Service (ECS) instance that belongs to another Alibaba Cloud account, a server that is provided by a third-party cloud service provider, or a self-managed data center.
- Logtail is installed on the server. For more information, see Install Logtail on a Linux server and Install Logtail on a Windows server.
Background information
If your server is an ECS instance that belongs to another Alibaba Cloud account, a server that is provided by a third-party cloud service provider, or a self-managed data center, you must first install Logtail on the server before you can collect logs from the server. Then, you must specify the ID of the Alibaba Cloud account for which Log Service is activated as a user identifier on the server. This way, the Alibaba Cloud account can use Logtail to collect logs from the server. If you do not configure a user identifier on your server, Log Service cannot receive the heartbeat of the server and Logtail cannot collect logs from the server.Step 1: Obtain the ID of the Alibaba Cloud account for which Log Service is activated
- Use the Alibaba Cloud account for which Log Service is activated to log on to the Alibaba Cloud official website.
- Open Cloud Shell.
- Run the following command to obtain the ID of the Alibaba Cloud account for which Log Service is activated:
echo $ALIBABA_CLOUD_ACCOUNT_ID
Step 2: Configure a user identifier
- Log on to the server.
- Specify the ID that you obtained as a user identifier on the server. Important
- If the /etc/ilogtail/users directory does not exist, create the directory.
- After you configure or delete a user identifier, the change takes effect within 1 minute.
- Linux In the /etc/ilogtail/users directory, create a file and set the name of the file to the ID of the Alibaba Cloud account.
touch /etc/ilogtail/users/17****745
- Windows In the C:\LogtailData\users directory, create a file and set the name of the file to the ID of the Alibaba Cloud account.
- Run the following command in Windows PowerShell to create the file:
ni C:\LogtailData\users\17******745
- Run the following command in the Command Prompt to create the file:
type nul > C:\LogtailData\users\17******745
- Run the following command in Windows PowerShell to create the file:
Multiple Alibaba Cloud accounts
If you want to use Log Service that is activated for multiple Alibaba Cloud accounts to collect logs from the same server, you can create multiple user identifier files on the server and configure the IDs of the Alibaba Cloud accounts as user identifiers. Example:
touch /etc/ilogtail/users/17****742
touch /etc/ilogtail/users/17****743
Delete a user identifier
Important We recommend that you delete user identifier files that you no longer need on a server at the earliest opportunity. Then, Log Service that is activated for the related Alibaba accounts has no permissions to collect logs from the server.
- Linux Run the following command to delete the specified user identifier file:
rm /etc/ilogtail/users/17****745
- Windows Run the following command to delete the specified user identifier file:
del C:\LogtailData\users\17******745