By default, the Simple Log Service data source plug-in is installed for Managed Service for Grafana of Application Real-Time Monitoring Service (ARMS). This plug-in allows you to synchronize Simple Log Service data and visualize the data in a Grafana dashboard in real time without the need to manually obtain or migrate the data. With the powerful real-time data analysis and visualization capabilities of Grafana, you can monitor the log data of Simple Log Service in real time to optimize system performance. This topic describes how to synchronize log data from Simple Log Service to Grafana 8.2.X, and use a Simple Log Service data source to create a Grafana dashboard.
Prerequisites
A Simple Log Service project is created. For more information, see Create a project.
A Logstore is created. For more information, see Manage a Logstore.
Indexes are created. For more information, see Create indexes.
The current RAM user has the AliyunLogFullAccess permission to access the data source.
Procedure
Log on to the ARMS console. In the left-side navigation pane, choose .
On the Workspace Management page, find the workspace that you want to manage and click the URL in the URL column to go to Grafana.
NoteYou can log on to Grafana with the administrator account of Grafana and the password that you configured when you created the workspace. You can also click Sign in with Alibaba Cloud to log on to Grafana with the current Alibaba Cloud account.
Configure the data source
In the left-side navigation pane, choose . Data sources
On the Data sources tab, click Add data source.
In the Others section of the Add data source page, click log-service-datasource.
NoteYou can also find the plug-in by entering log-service-datasource in the search box at the top of the page. Fuzzy match is supported.
On the configuration page of log-service-datasource, configure the following parameters.
Parameter
Description
Name
The name of the data source. The name can be user-defined.
Endpoint
The endpoint of the project whose data you want to synchronize. You can view the endpoint on the Project Overview tab of the project. For more information, see Endpoints.
Network Type
Select a network type from the drop-down list.
Project
The name of the project. You can view the project name in the Projects section in the Simple Log Service console.
Logstore
The name of the Logstore whose data you want to synchronize. You can view the Logstore name in the project.
AccessKeyId
AccessKeyId: The AccessKey ID is used to verify user identities.
AccessKeySecret: The AccessKey secret is used to encrypt and verify the signature string for authentication. You must keep your AccessKey secret strictly confidential.
For more information, see View the information about AccessKey pairs of a RAM user.
AccessKeySecret
Click Save & test.
If the following information is returned, the data source is added.
Create a dashboard panel
In this example, a graph that displays information about page views and unique visitors is added. For more information about how to add other types of charts or graphs, see Add a dashboard.
In the left-side navigation pane, choose .
On the New dashboard page, click Add an empty panel.
In the Query section of the Edit Panel page, select log-service-datasource from the Data source drop-down list and configure the following parameters.
Parameter
Description
Example
Query
Enter a query statement based on the metrics in the data source.
Sample statement for querying PVs:
* | select count(*) as c, __time__-__time__%60 as t group by t
ycol
The metric shown in the Y-axis.
The total number of log entries: c
xcol(time)
The metric shown in the X-axis. Generally, the parameter is set to the time t.
Time: t
In the right-side pane, specify the name, type, and graph styles of the monitoring chart.
Click Apply.
The dashboard panel is created.
In the upper-right corner, click the icon. Then, specify the name of the dashboard and the directory in which the dashboard resides.
Click Save.
The dashboard is created.
View monitoring data
In the left-side navigation pane, choose .
On the Manage tab, find the folder in which the dashboard is stored and click the dashboard.
View all monitoring charts on the dashboard.
References
Simple Log Service allows you to store log data and time series data. For information about how to import time series data to Managed Service for Grafana, see Send time series data from Log Service to Grafana.