Visualize regional data on a China map dashboard using the ip_to_province 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 left navigation pane, click Log Storage. In the Logstores list, click the Logstore.
-
Enter the following query and click Search & Analyze.
The ip_to_province function maps IP addresses to province names. To return English names, add the
'en'parameter:ip_to_province(client_ip,'en').* | select ip_to_province(http_x_forwarded_for) as province, count(1) as c group by province order by c desc limit 100000
Step 2: Configure the map of China
-
In the left navigation pane, choose . In the Dashboard list, click the dashboard. In the upper-right corner, click Edit. In edit mode, click .
-
In the right panel, choose . Set the time range, Logstore, and query statement on the left. Configure other settings on the right, then click Apply to preview.
-
: Visualizes data by geographic region.
-
: Region data field (province or municipality). In this example,
province. -
: Value field for each region. In this example,
c(log count). -
: Geographic scope. Set to National to display all of China.
-