All Products
Search
Document Center

Application Real-Time Monitoring Service:Add and use a Simple Log Service data source

Last Updated:Aug 28, 2024

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 data of Simple Log Service and visualize the data in a Grafana dashboard in real time without the need to manually obtain or migrate the data. Based on 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, and how to create a dashboard by using a Simple Log Service data source.

Prerequisites

  • A project is created in Simple Log Service. For more information, see the "Create a project" section of the Manage a project topic.

  • A Logstore is created in Simple Log Service. For more information, see Manage a Logstore.

  • Indexes are created. For more information, see Create indexes.

  • The current Resource Access Management (RAM) user is attached with the AIiyunLogReadOnIyAccess or AliyunLogFuIIAccess policy to access the data source.

Step 1: Log on to Grafana

  1. Log on to the ARMS console. In the left-side navigation pane, choose Managed Service for Grafana > Workspace Management.

  2. 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.

    Note

    You 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.

Step 2: Add a Simple Log Service data source

Grafana 9.0.x

  1. In the left-side navigation bar, move the pointer over the image icon and select Data sources. On the Data sources tab, click Add data source.

  2. On the Add data source page, search for and click log-service-datasource.

  3. On the configuration page of log-service-datasource, configure the parameters that are described in the following table.

    Parameter

    Description

    Name

    The name of the data source. You can specify a custom name. In this example, log-service-datasource is used.

    Endpoint

    The endpoint of the project. You can view the endpoint on the Project Overview tab of the project details page. In this example, cn-beijing.log.aliyuncs.com is used. For more information, see Endpoints.

    Project

    The name of the project from which you want to synchronize data. You can obtain the project name in the Projects section on the homepage of the Simple Log Service console. Example: k8s-log-c85aee79d9bfd437e9a518e**********.

    Logstore

    The name of the Logstore whose data you want to synchronize. You can obtain the Logstore name on the project details page. Example: apiserver-c85aee79d9bfd437e9a518e**********.

    AccessKeyId

    • The AccessKey ID, which is used to verify the identity of a user. For more information about how to view AccessKey IDs, see View the information about AccessKey pairs of a RAM user.

    • The AccessKey secret, which is used to encrypt and verify the signature string for identity authentication. The AccessKey secret is not displayed in the console. After you create a RAM user, you must save the AccessKey secret of the RAM user.

    AccessKeySecret

    image

  4. Click Save & test.

    If the Data source is working message appears, the data source is added.

Grafana 10.0.x

  1. On the Grafana homepage, click the image icon.

  2. In the left-side navigation pane, choose Management > Data sources.

  3. On the Data sources page, click + Add new data source.

  4. On the Add data source page, search for and click log-service-datasource.

  5. On the configuration page of log-service-datasource, configure the parameters that are described in the following table.

    Parameter

    Description

    Name

    The name of the data source. You can specify a custom name. In this example, log-service-datasource is used.

    Endpoint

    The endpoint of the project. You can view the endpoint on the Project Overview tab of the project details page. In this example, cn-beijing.log.aliyuncs.com is used. For more information, see Endpoints.

    Project

    The name of the project from which you want to synchronize data. You can obtain the project name in the Projects section on the homepage of the Simple Log Service console. Example: k8s-log-c85aee79d9bfd437e9a518e**********.

    Logstore

    The name of the Logstore whose data you want to synchronize. You can obtain the Logstore name on the project details page. Example: apiserver-c85aee79d9bfd437e9a518e**********.

    AccessKeyId

    • The AccessKey ID, which is used to verify the identity of a user. For more information about how to view AccessKey IDs, see View the information about AccessKey pairs of a RAM user.

    • The AccessKey secret, which is used to encrypt and verify the signature string for identity authentication. The AccessKey secret is not displayed in the console. After you create a RAM user, you must save the AccessKey secret of the RAM user.

    AccessKeySecret

    image

  6. Click Save & test.

    If the Data source is working message appears, the data source is added to Grafana.

Step 3: Create a dashboard panel

Note

The following examples show how to create a time series chart of page views (PVs). For information about how to create charts of other types, see the "Step 3: Add a dashboard" section of the Connect Simple Log Service to Grafana topic.

Grafana 9.0.x

  1. In the left-side navigation pane of Grafana, choose image > New dashboard.

  2. On the New dashboard page, click Add a new panel.

  3. On the Query tab of the Edit Panel page, select the data source that you added in Step 2 from the Data source drop-down list.

  4. Configure the parameters that are described in the following table, and then set the Title parameter on the right side of the page to PV.

    Parameter

    Description

    Example

    Query

    The query statement. Specify the 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 in the Y-axis.

    The total number of log entries: c

    xcol(time)

    The metric in the X-axis. In most cases, the parameter is set to the time t.

    Time: t

    image

  5. Click Apply.

  6. In the upper-right corner, click the 保存监控大盘 icon. Then, specify the name of the dashboard and the directory in which the dashboard resides.

  7. Click Save.

Grafana 10.0.x

  1. On the Grafana homepage, click the image icon.

  2. In the left-side navigation pane, click Dashboards. On the page that appears, select New dashboard from the New drop-down list.

  3. On the New dashboard page, click + Add visualization.

  4. On the left side of the Select data source dialog box, select the data source that you added in Step 2.

  5. Configure the parameters that are described in the following table, and then set the Title parameter on the right side of the page to PV.

    Parameter

    Description

    Example

    Query

    The query statement. Specify the 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 in the Y-axis.

    The total number of log entries: c

    xcol(time)

    The metric in the X-axis. In most cases, the parameter is set to the time t.

    Time: t

    image

  6. Click Apply.

  7. In the upper-right corner, click the 保存监控大盘 icon. Then, specify the name of the dashboard and the directory in which the dashboard resides.

  8. Click Save.

Step 4: View the monitoring data

Grafana 9.0.x

  1. In the left-side navigation bar, click the image icon.

  2. On the Browse tab, click the folder in which the dashboard you want to view is stored, and click the dashboard. On the page that appears, view all monitoring charts on the dashboard.

Grafana 10.0.x

  1. On the Grafana homepage, click the image icon.

  2. In the left-side navigation pane, click Dashboards. On the Dashboards page, click the folder in which the dashboard you want to view is stored, and click the dashboard. On the page that appears, 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 Grafana, see Send time series data from Simple Log Service to Grafana.