TLS provides a data source plugin for rapid integration of log data with Grafana, making it easy to visualize and analyze log data in Grafana. This topic describes how to connect log data to Grafana using TLS data source plugin.
Background information
As an open-source visualization monitoring platform, Grafana offers features like data metrics monitoring and visual analysis. It is commonly used for large-scale metrics data and time series data visualization, especially in scenarios such as network architecture and application performance analysis. Once log data is collected by TLS, you can use the provided data source plugin to integrate log data with Grafana. In Grafana, you can create visual dashboards and charts for log data analysis.
The data source plugin provided by TLS supports using VolcanoEngine access keys to retrieve all log topics under the current account, as well as fetching only specific log topic data. The configuration methods for the two data sources are described in the following table. Select the appropriate method based on your business needs.
Prerequisites
- Logs have been collected. For steps, see Overview .
- TLS supports integration with Grafana versions 6.0 to 12.x (dashboard import supports versions 8.0.x to 12.x). This topic uses Grafana 9.5.8 as an example to describe related steps.
Add data source steps
1. Download and install the data source plugin
- Grafana version 9.0 and later
- Grafana versions 6.x–8.x
- Extract the data source plugin package to the Grafana plugin directory.
- Select the corresponding Grafana plugin directory and run the appropriate command based on your installation method.
- Edit the permissions in the Grafana configuration file.
- Add permission parameters for the data source plugin in the Grafana configuration file to allow Grafana to load this plugin.
Tip
Grafana 6.x by default allows loading unsigned plugins; no additional configuration is required.
- Run the following command to restart Grafana and apply the plugin configuration.
- Run the kill command to terminate the Grafana process.
- Select the appropriate command based on your installation method to restart Grafana.
2 Add data source
Description
The Grafana interface may vary by version. Refer to the actual interface for accuracy.
Add TLS as a data source in Grafana.
- Log in to Grafana as an administrator.
- On the left menu, select Administration > Data sources.
- On the Data sources tab, click Add new data source.
- On the Add data source page, locate and click Tls-Grafana-Datasource.
- Fill in the data source configuration.
- Set the data source name.
- Select the configuration mode.
- Configure the data source information.
- Specify only the access key method (Account mode)
- Enable AccountMode and configure the following parameters:
-
- Specify the log topic method (Single Topic mode)
- Enable AccountMode and configure the following parameters:
-
Step 2: Add dashboard actions
1. Obtain the data source UID
- In the Data sources tab in Grafana.
- Click the data source you added in the previous step, and get the data source UID from the URL bar at the top.
-
2 Get Grafana-format dashboard
3 Import a Grafana-format dashboard
- In the left navigation pane in Grafana, click Dashboards.
- In the top right corner of the page, select New > Import.
- On the Import dashboard tab, upload the Grafana-format dashboard JSON file, or paste the JSON directly into Import via dashboard JSON model, and then click Load.
-
- In the left navigation pane, click Dashboards.
- In the upper right corner of the page, select New > New Dashboard.
- In the upper right corner of the New dashboard page, click the Settings icon.
- On the General page, set the name of the dashboard.
-
- In the upper right corner of the page, click Save dashboard, and then click Save.
2 (Optional) Add variables
- In the upper right corner of the dashboard page, click the Settings icon.
- In the left navigation bar, click Variables.
- On the Variables page, click New variable.
- Set the parameters for the variable. Keep other parameters as default, and then click Apply.
-
Configuration examples of querying variables via specifying access key (Account mode)
Tip
If the added data source uses the specified Access Key method (Account mode), you can configure custom variables such as Region, Topic and Log via query type to implement multi-Topic queries across regions or within the same region.
- In the upper right corner of the page, click Save dashboard, and then click Save.
- After adding variables, you can view variables and their values in the upper right corner of the chart page.
-
3 Add chart
After adding a data source, you need to create a dashboard in Grafana and add charts to it.
- On the dashboard page, click Add visualization.
- On the Select data source page, select the TLS data source you created in 2 Add data source.
- Fill in the relevant configuration for query and analysis.
- Select the region (region) and log topic (topic) for the data source.
Description
When configuring the data source by specifying access key only, you need to select the target region and log topic.
- Enter your query and analysis statement in Query.
- The query and analysis statement should follow the syntax of Volcengine TLS query and analysis. For more details, see Query overview and Analysis overview. When filtering chart data with variables, you need to add variable placeholders in the query and analysis statement. The format is Field name: ${Variable name}.
- Example without Variable
-
- In the query and analysis statement, insert the variable Method:${Method} and then you can filter chart data using the variable.
-
- Select the chart type on the right side of the page.
- Configure Panel options based on business requirements.
- At the upper right corner of the page, click Save. In the Save dashboard panel, click Save.
- If you want to continue adding visualization charts, at the upper right corner of the dashboard, click Add > Visualization.
-
Chart configuration examples
TLS provides chart configuration examples for common scenarios for your reference.
Bar charts are typically used to display categorized data, with each category represented by a bar whose height reflects the value for that category. For steps to add a bar chart, see 3 Add chart. The configuration example for a bar chart is as follows: - Use a bar chart to display the PV and UV for each request method.
-
-
Tables can be used to display or compare values of the same type of fields, such as querying user operation times in access logs and similar scenarios. For steps to add a table, see 3 Add chart. The table configuration example is as follows: - Display PV and UV for every 5 minutes using a table.
-
-
Time series chart
Time series charts show data trends at different time points, such as viewing access trends over a period. For steps to add a time series chart, see 3 Add chart. The following is a configuration example for a sequence diagram: - The sequence diagram shows the trend of PV changes within each 5-minute interval.
-
-
- The sequence diagram displays the IOPS changes of each cluster over time.
-
-
Gauge charts highlight query and analysis results in rectangular frames. They are ideal for prominently displaying data, such as key information at a specific moment or during a certain period. For steps to add a gauge chart, see 3 Add chart. Configuration examples for gauge charts are as follows: - Display PV and UV using gauge charts.
-
-
Pie charts show the proportion of different categories and compare differences using arcs, highlighting each category's value relative to the total. For instructions on adding a pie chart, see 3 Add chart. Pie chart configuration examples: - Display the number of requests for each status with a pie chart.
-
-
Notice
The TLS Grafana plugin does not provide map functionality; maps are supported by Grafana.
The map shows regional distribution. For instructions on adding a map, see 3 Add chart. Currently, you can configure maps through the Echarts plugin and Worldmap Panel. The configuration examples are as follows: - Display the distribution of request quantities across regions using the map.
-
-
- Install and configure the Echarts plugin before using it. For more details, see the Echarts plugin.
- Display the distribution of request quantities across regions using the map.
-
-
Examples of viewing raw log configuration
Using the TLS Grafana plugin, you can view raw logs directly within Grafana dashboards. The steps are shown below:
- Configure dashboard Visualization parameters, and select Logs.
- Configure dashboard Query parameters, and select Logs in xcol field.
-
- Select Data source and enter query statements. Then you can view raw logs.
- For example, you can enter "1e1589926ae14140812ab4f2b6c0ac34" to query raw logs that contain this ID.
-