All Products
Search
Document Center

Simple Log Service:Configure a user identifier

Last Updated:Apr 03, 2024

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.

    Prepare an Elastic Compute Service (ECS) instance that belongs to a different Alibaba Cloud account from your Simple Log Service project, a server from a third-party cloud service provider, or a server in a 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 a different Alibaba Cloud account from Simple Log Service, a server from a third-party cloud service provider, or a server in a data center, you must use Logtail to collect logs from the server. You must install Logtail on your server, specify the ID of the Alibaba Cloud account to which your Simple Log Service project belongs as a user identifier on the server, and then grant the account the permissions to collect logs from the server by using Logtail. If you do not configure a user identifier on the server, the heartbeat status of the server may be displayed as failure in the machine group to which the server is added. As a result, Logtail cannot collect or send logs to Simple Log Service.

Step 1: Obtain the ID of the Alibaba Cloud account to which your Simple Log Service project belongs

  1. Use the Alibaba Cloud account to which your Simple Log Service project belongs to log on to the Alibaba Cloud official website.

  2. Open Cloud Shell.

  3. Run the following command to obtain the ID of the Alibaba Cloud account:

    echo $ALIBABA_CLOUD_ACCOUNT_ID

    获取主账号ID

Step 2: Configure a user identifier

  1. Log on to the server by using the Alibaba Cloud account to which the server belongs.

  2. Specify the account 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 configuration takes effect within 1 minute.

    Linux system

    In the /etc/ilogtail/users directory, create a file whose name is the ID of the Alibaba Cloud account.

    touch /etc/ilogtail/users/17****745

    Windows system

    In the C:\LogtailData\users directory, create a file whose name is 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

    Container environment

    If you deploy Logtail in a Kubernetes cluster and use logtail-ds V1.7.3 or later, you can configure a custom identifier in the ACK console. You can modify the LogtailDSExternalUserDefinelDs parameter of the logtail-ds component on the Add-ons page. For more information, see Manage components.

Multiple Alibaba Cloud accounts

If you want to use Simple 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 specify the IDs of the Alibaba Cloud accounts as the 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 from servers at the earliest opportunity. After you delete the files, the granted collection permissions are revoked.

Linux system

Run the following command to delete a user identifier file:

rm /etc/ilogtail/users/17****745

Windows system

Run the following command to delete a user identifier file:

del C:\LogtailData\users\17******745

References

After you specify the ID of an Alibaba Cloud account as a user identifier on a server, you can create a machine group. For more information, see Create an IP address-based machine group or Create a custom identifier-based machine group.