Display geographic information on a world map using the ip_to_country function.
Prerequisites
-
Log data is collected. Collect text logs from servers.
-
An index is created. Create an index.
-
A dashboard is created. Quickly create a dashboard.
Step 1: Query and analyze data
Log on to the Simple Log Service console. In the Projects section, click the project you want.

-
In the navigation pane on the left, click Log Storage. In the Logstores list, click the target Logstore.
-
Enter the following query and click Search & Analyze.
The ip_to_country function converts IP addresses to country names. Pass
ip_to_country(source_field, 'en')to return English names.* | select ip_to_country(remote_addr, 'en') as address, count(1) as count group by address order by count desc limit 10
Step 2: Configure a world map
-
In the navigation pane on the left, go to . In the Dashboard list, click the target dashboard. In the upper-right corner of the dashboard, click Edit, and then click .
-
On the Edit Chart page, choose in the right-side pane. In the left-side pane, set the time range, Logstore, and query. Configure the General Configurations settings, then click Apply to preview the chart.
-
: Display data by area.
-
: The field containing area data. Select
addressfor this example. Values are country names such as Chinese mainland. -
: The metric to display. Select
countto show the log count per country.
-