All Products
Search
Document Center

Simple Log Service:How do I query the source machine and number of logs?

Last Updated:Apr 15, 2024

This topic describes how to query the source machine and number of logs in the Simple Log Service console.

If you use Logtail to collect logs, you can apply the Logtail configuration to machine group. For an IP address-based machine group, servers in the machine group are differentiated by using IP addresses. When you query logs, you can use the hostname and IP address to determine the source machine of logs.

Procedure

Simple Log Service collects hostname information from different logs and counts the number of logs.

  1. Log on to the Simple Log Service console.

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

    image

  3. Click the Logstore that you want to manage.

  4. In the search box, enter the following query statement and click Search & Analyze. The system returns the source machine of logs and the number of logs.

    Note

    Before you can query logs in a Logstore, you must enable the index feature for the Logstore and turn on Enable Analytics for the __tag__:__hostname__ field.

    * | select "__tag__:__hostname__" , count(1) as count group by "__tag__:__hostname__"