You need to enable JavaScript to run this app.
Torch Log Service

Torch Log Service

Copy page
Download PDF
general reference
Set IP addresses for hosts or containers
Copy page
Download PDF
Set IP addresses for hosts or containers
TLS allows you to specify an IP address for a host or adjust the LogCollector IP address obtaining policy. This makes it easier to identify or manage hosts within a host group. This topic describes how to set IP addresses for hosts or containers.​
Background information​
To identify and manage hosts or containers within a host group, TLS LogCollector needs to read the IP addresses of the hosts or containers. By default, LogCollector takes the first network interface IP address as the IP address of the host or container and then reports it to the server. You can also specify an IP address for the host or adjust the LogCollector IP address obtaining policy as needed.​
If both the IP address obtaining policy and a specific IP address are set, the specified IP address takes precedence.​
​
Configuration methods​
Description​
Set IP address obtaining policy​
Set the ip_policy parameter in the LogCollector configuration file to configure the IP address obtaining policy for LogCollector. By default, LogCollector uses the first network interface's IP address as the host or container IP address. You can modify the IP address obtaining policy to retrieve the IP address from a specified network interface or obtain IP address in a specific order. For more details, see Policy description.​
This method suits scenarios where host or container logs are collected. We recommend that you use this method for host groups with host identification type.​
Specify IP address​
When installing LogCollector on the host, you can set the ip parameter during initialization to assign a fixed IP address to the host. After installing LogCollector, you can also modify the IP address by updating the configuration file. For detailed instructions, see Specify IP address.​
This method is only applicable for collecting logs from the host machine where host group type is IP address type.​
​
Set IP address obtaining policy​
Hosts or containers within a host group are distinguished by their IP addresses. In host groups of host identification type, if IP address obtained by LogCollector changes frequently, it will cause inconvenience for administrators to distinguish and identify different hosts or containers. In this case, you can set an IP address obtaining policy for LogCollector. For example, you can set the policy to read the IP address from a specified network interface or to obtain the IP address in a specific order.​
Policy description​
Host groups distinguish hosts and containers by their IP addresses. The IP address is automatically obtained and reported to the server by LogCollector installed in the host or container. By default, LogCollector takes the first network interface IP address as the host or container IP address. You can also adjust the obtaining policy as needed.​
TLS LogCollector supports the following IP address obtaining policies:​
  • (Default) Use the IP address of the first network interface as the host or container IP address.​
  • Uses the IP address of the specified network interface as the host or container IP address. If the IP address is obtained successfully, this address is used as the host or container IP address; if fails, use the IP address of the first network interface as the host or container IP address.​
  • Obtains IP address in the sequence: hostname > eth0 > bond0. If the IP address is obtained successfully, this address is used as the host or container IP address; if fails, LogCollector moves to the next sequence. If all fails, the IP address of the first network card is used as the host or container IP address.​
Configuration methods​
Add the ip_policy parameter to the output.tls section of the configuration file to specify the policy that LogCollector obtains IP addresses. The configuration file path is as follows:​
  • Logcollector versions prior to v2.2.0: /usr/local/filebeat-7.12.0/etc/filebeat.yml​
  • Logcollector v2.2.0 and later: /usr/local/logcollector/etc/logcollector.yml​
To view LogCollector version, see 2. View software version.​
Tip​
After modifying the settings, restart LogCollector to apply the configuration. For restart instructions, see 3. Process management.​
The ip_policy parameter supports the following configuration methods:​
​
Parameter configuration​
Description​
ip_policy: ''​
Uses the IP address of the first network interface as the host or container IP address. This setting is default.​
ip_policy: 'hostname'​
Obtains IP address in the sequence: hostname > eth0 > bond0.​
ip_policy: "Network interface name"​
Uses the IP address of the specified network interface as the host or container IP address.​
​
For example, to use the IP address of eth1 as the host IP address, configure as follows:​
​
output.tls:​
endpoint: 'https://tls-cn-beijing.ivolces.com' #--Service address for TLS.​
secret_id: Your Secrect Id #--Access Key ID for Volcanoengine account​
secret_key: Your Secrect Key #--Secret Access Key for Volcanoengine account​
region: cn-beijing #--Region where the project is located​
compress_type: lz4 #--Compression type; lz4 is recommended as the default setting.​
label: http_module #--Custom host identification​
ip_policy: 'eth1' #--IP address obtaining strategy​
​
Specify IP address​
When collecting host machine logs, if you use an IP address-based host group, you must configure the host's IP address for the host group. The IP address must be the one obtained by LogCollector; otherwise, a mismatch may cause LogCollector heartbeat failures for the corresponding host. If the automatically obtained IP address by LogCollector is not suitable, or multiple rules of the IP address obtaining policy do not meet your business needs, you can manually specify an IP address for the host based on the following instructions.​
  • Specify IP address when installing LogCollector:​
  • You can set the ip parameter during initialization to directly specify an IP address for the host. For details, see 2 Install and start LogCollector. When creating a host group, enter this IP address in the settings. The IP address will be used as the host's installation identifier displayed in the host group.​
  • Modify IP address after installing LogCollector:​
  • During LogCollector operation, to update authentication parameters such as secret_id and secret_key, or identification parameters like label, execute the following command to edit the LogCollector configuration file.​
  • ​
    sudo /usr/local/logcollector/tools/logcollector.sh update_config --region {region} --endpoint {endpoint} --secret_id {secret_id} --secret_key {secret_key} --label {label} ​
    ​
​
​
Last updated: 2025.12.12 18:20:07