All Products
Search
Document Center

Simple Log Service:Create a custom identifier-based machine group

Last Updated:Apr 02, 2024

Simple Log Service allows you to define a machine group by using a custom identifier. This topic describes how to create a custom identifier-based machine group.

Prerequisites

Background information

Custom identifier-based machine groups provide benefits in the following scenarios:

  • If your servers reside in multiple custom network environments such as virtual private clouds (VPCs), the IP addresses of some servers may conflict. In this case, Simple Log Service cannot manage Logtail. You can create a custom identifier-based machine group to prevent this issue.

  • You can flexibly scale a machine group by configuring the same custom identifier for multiple servers. If you configure the same custom identifier for new servers that you want to add to a machine group, Simple Log Service identifies the custom identifier and adds the servers that have the same custom identifier to the machine group.

Procedure

  1. Create a file named user_defined_id in a specific directory.

    • Linux server: Create the file in the /etc/ilogtail/user_defined_id directory.

    • Windows server: Create the file in the C:\LogtailData\user_defined_id directory.

  2. Configure a custom identifier for your servers.

    Important
    • Windows and Linux servers cannot be added to the same machine group. Do not configure the same custom identifier for Linux and Windows servers.

    • You can configure one or more custom identifiers for a single server and separate the identifiers with line feeds.

    • On a Linux server, if the /etc/ilogtail/ directory or the /etc/ilogtail/user_defined_id file does not exist, you must create the directory and file. On a Windows server, if the C:\LogtailData directory or the C:\LogtailData\user_defined_id file does not exist, you must also create the directory and file.

    • Linux server

      Configure a custom identifier in the /etc/ilogtail/user_defined_id file. For example, if you want to configure the custom identifier as userdefined, run the following command to edit the file. Then, enter userdefined in the file and save the file.

      vim /etc/ilogtail/user_defined_id
    • Windows server

      Configure a custom identifier in the C:\LogtailData\user_defined_id file. For example, if you want to configure the custom identifier as userdefined_windows, enter userdefined_windows in the C:\LogtailData\user_defined_id file and save the file.

  3. Log on to the Simple Log Service console.

  4. In the Projects section, click the project that you want to manage.

    image

  5. In the left-side navigation pane, choose Resources > Machine Groups.

  6. On the right of Machine Groups, choose 机器组 > Create Machine Group.

  7. In the Create Machine Group panel, configure the parameters and click OK. The following table describes the parameters.

    Parameter

    Description

    Name

    The name of the machine group.

    Important

    After the machine group is created, you cannot change the name of the machine group. Proceed with caution.

    Machine Group Identifier

    The identifier type of the machine group. Select Custom Identifier.

    Machine Group Topic

    The topic of the machine group. The topic is used to identify logs that are generated by different servers. For more information, see Log topics.

    Custom Identifier

    The custom identifier of the machine group. Specify the custom identifier that you configured in Step 2.

  8. View the status of the machine group.

    1. In the Machine Groups list, click the machine group that you want to manage.

    2. On the Machine Group Configurations page, view the servers that have the same custom identifier and the heartbeat status of each server.

      • The Machine Group Status section displays the IP addresses of the servers that have the same custom identifier.

        For example, a custom identifier-based machine group is created, the custom identifier is userdefined, and the IP addresses in the Machine Group Status section are 10.10.10.10, 10.10.10.11, and 10.10.10.12. This indicates that you configured the same custom identifier for the servers in the machine group. If you want to add another server to the machine group and the IP address of the server is 10.10.10.13, configure a custom identifier for the server as userdefined. Then, you can view the IP address of the server in the Machine Group Status section.

      • If the value in the Heartbeat column for a server is OK, Logtail on the server is connected to Simple Log Service. If the value is FAIL, the connection failed. For more information, see What do I do if a Logtail machine group has no heartbeats?

        Important

        If you check the status of a machine group immediately after the machine group is created, the heartbeat may be FAIL because the connection has not taken effect. In this case, click Refresh.

      机器组状态

Disable a custom identifier

If you want to change the value of the Machine Group Identifier parameter to IP Address, you must delete the user_defined_id file. The new configurations take effect within 1 minute.

  • Linux

    rm -f /etc/ilogtail/user_defined_id
  • Windows

    del C:\LogtailData\user_defined_id

Effective period

By default, after you create, delete, or modify the user_defined_id file, the new configurations take effect within 1 minute. If you want the new configurations to immediately take effect, run the following commands to restart Logtail:

  • Linux

    /etc/init.d/ilogtaild stop
    /etc/init.d/ilogtaild start
  • Windows

    1. Choose Start Menu > Control Panel > Administrative Tools > Services.

    2. In the Services dialog box, select the service that you want to manage.

      • For Logtail V0.x.x.x, select LogtailWorker.

      • For Logtail V1.0.0.0 or later, select LogtailDaemon.

    3. Right-click the service and select Restart for the configurations to take effect.