Use BLS via Grafana

BLS

  • Function Release Records
  • Product Description
    • Usage restrictions
    • Product Introduction
  • Product pricing
  • Quick Start
    • Introduction
    • Install agent
    • Create LogStore
    • Create Transmission Task
    • Log Analysis and Alerting
    • Create Delivery Task
  • Operation guide
    • Baidu Intelligent Cloud Environment Preparation
    • Overview
    • Identity and access management
    • Logset Management
    • Agent
      • Install Agent on Host
      • Install Agent in K8s Environment
      • Agent Management
      • Agent Release Version
      • Set Agent Startup Parameters
    • Log Collection
      • Transmission Task Collection
        • Create Transmission Task
        • Manage Transmission Task
      • Uploading Logs Using Kafka Protocol
    • Query analysis
      • Log query
      • SQL Syntax
      • Search Syntax
    • Dashboard
      • Overview
      • Management Dashboard
      • Management Dashboard Charts
    • Alarm management
      • Alert Overview
      • Alarm strategy
        • Management alarm strategy
        • Trigger conditions
      • Alarm history
      • Alert execution statistics
      • Alarm notification
        • Alarm Notification Template
        • Alarm callback
    • Data processing
      • Log Delivery
        • Log Delivery Overview
        • Create Delivery Task
        • Manage Delivery Task
      • Scheduled SQL Analysis
        • Manage Scheduled SQL Analysis Task
        • Create Scheduled SQL Analysis Task
      • Real-Time Consumption
      • Data processing
        • Data processing
          • Overview of data processing functions
          • Process control function
          • Mapping enrichment functions
          • Event operation functions
          • Field operation functions
          • Field value extraction functions
    • Log Applications
      • Intelligent Diagnostics
  • Best Practices
    • Use Year-Over-Year and Month-Over-Month as Alert Trigger Conditions
    • BLS Integration with Kibana
    • Use BLS via Grafana
  • Development Guide
    • API Reference
      • API function release records
      • API Overview
      • Interface Overview
      • General Description
      • Service domain
      • Common error codes
      • Terminology
      • Project Related APIs
        • Create Project
        • Update Project
        • Describe Project
        • Delete Project
        • List Project
      • LogStore Related APIs
        • Create LogStore
        • Update LogStore
        • Delete LogStore
        • Describe LogStore
        • Batch Get LogStore
        • List LogStore
      • LogStream Related APIs
        • List LogStream
      • LogRecord Related APIs
        • Push log PushLogRecord
        • Obtain logrecord PullLogRecord
        • Search analysis log QueryLogRecord
        • Histogram API QueryLogHistogram
      • Fast Query FastQuery Related Interfaces
        • Create Fast Query CreateFastQuery
        • Update Fast Query UpdateFastQuery
        • Delete Fast Query DeleteFastQuery
        • Get Fast Query Details DescribeFastQuery
        • Get Fast Query List ListFastQuery
      • Index Related APIs
        • Create Index
        • Update Index
        • Delete Index
        • Describe Index
      • Log Shipper LogShipper Related Interfaces
        • Create Log Shipper
        • Update Log Shipper
        • Set Single Log Shipper Status
        • Delete Single Log Shipper
        • Bulk Delete Log Shipper
        • List Log Shipper Records
        • List Log Shipper
        • Bulk Set Log Shipper Status
        • Get Log Shipper
      • Alarm-Related Interfaces
        • CreateAlarmPolicy
        • UpdateAlarmPolicy
        • DeleteAlarmPolicy
        • ValidateAlarmCondition
        • ValidateAlarmPolicySQL
        • EnableAlarmPolicy
        • DescribeAlarmRecord
        • DisableAlarmPolicy
        • DescribeAlarmPolicy
        • ListAlarmPolicy
        • ListAlarmRecord
        • ListAlarmExecutionStats
        • ListAlarmExecutions
      • LogStore Template-Related Interfaces
        • CreateLogStoreTemplate
        • UpdateLogStoreTemplate
        • DeleteLogStoreTemplates
        • DescribeLogStoreTemplates
        • DescribeLogStoreTemplate
      • Download Log Download Related Interfaces
        • Create Download Task CreateDownloadTask
        • Get Download Task List ListDownloadTask
        • Delete Download Task DeleteDownloadTask
        • Get Download Task Address GetDownloadTaskLink
        • Get Download Task Details DescribeDownloadTask
      • LogAlarm Related Interfaces
        • SetLogAlarmStatus
        • deleteLogAlarm
        • createLogAlarm
        • listLogAlarm
        • updateLogAlarm
        • BulkDeleteLogAlarm
        • PreviewAlarmLogRecord
        • getLogAlarm
        • BulkSetLogAlarmStatus
      • Transmission Task Related Interfaces
        • Create Task CreateTask
        • UpdateTask
      • Interfaces Compatible with Elasticsearch
        • ResolveIndex
        • FieldCaps
        • TermsEnum
        • AsyncSearch
    • SDK Reference
      • Go SDK
        • Overview
        • Initialization
        • Version Release Records
        • Project Operations
        • LogStore Operations
        • Install the SDK Package
        • LogStream Operations
        • LogRecord Operations
        • FastQuery Operations
        • LogShipper Operations
        • Index Operations
        • Download Task Operations
      • Java SDK
        • Overview
        • Install the SDK Package
        • LogRecord Operations
      • iOS SDK
        • Overview
        • Quick start
        • Version Release Records
      • Android SDK
        • Overview
        • Quick start
        • Version Release Records
      • Android & iOS SDK Download
      • SDK Privacy Policy
      • SDK Developer Personal Information Protection Compliance Guide
    • Importing SLS Collection Configuration
  • FAQs
    • Common Questions Overview
    • Fault-related questions
    • Configuration-related questions
  • Log Service Level Agreement SLA
All documents
menu
No results found, please re-enter

BLS

  • Function Release Records
  • Product Description
    • Usage restrictions
    • Product Introduction
  • Product pricing
  • Quick Start
    • Introduction
    • Install agent
    • Create LogStore
    • Create Transmission Task
    • Log Analysis and Alerting
    • Create Delivery Task
  • Operation guide
    • Baidu Intelligent Cloud Environment Preparation
    • Overview
    • Identity and access management
    • Logset Management
    • Agent
      • Install Agent on Host
      • Install Agent in K8s Environment
      • Agent Management
      • Agent Release Version
      • Set Agent Startup Parameters
    • Log Collection
      • Transmission Task Collection
        • Create Transmission Task
        • Manage Transmission Task
      • Uploading Logs Using Kafka Protocol
    • Query analysis
      • Log query
      • SQL Syntax
      • Search Syntax
    • Dashboard
      • Overview
      • Management Dashboard
      • Management Dashboard Charts
    • Alarm management
      • Alert Overview
      • Alarm strategy
        • Management alarm strategy
        • Trigger conditions
      • Alarm history
      • Alert execution statistics
      • Alarm notification
        • Alarm Notification Template
        • Alarm callback
    • Data processing
      • Log Delivery
        • Log Delivery Overview
        • Create Delivery Task
        • Manage Delivery Task
      • Scheduled SQL Analysis
        • Manage Scheduled SQL Analysis Task
        • Create Scheduled SQL Analysis Task
      • Real-Time Consumption
      • Data processing
        • Data processing
          • Overview of data processing functions
          • Process control function
          • Mapping enrichment functions
          • Event operation functions
          • Field operation functions
          • Field value extraction functions
    • Log Applications
      • Intelligent Diagnostics
  • Best Practices
    • Use Year-Over-Year and Month-Over-Month as Alert Trigger Conditions
    • BLS Integration with Kibana
    • Use BLS via Grafana
  • Development Guide
    • API Reference
      • API function release records
      • API Overview
      • Interface Overview
      • General Description
      • Service domain
      • Common error codes
      • Terminology
      • Project Related APIs
        • Create Project
        • Update Project
        • Describe Project
        • Delete Project
        • List Project
      • LogStore Related APIs
        • Create LogStore
        • Update LogStore
        • Delete LogStore
        • Describe LogStore
        • Batch Get LogStore
        • List LogStore
      • LogStream Related APIs
        • List LogStream
      • LogRecord Related APIs
        • Push log PushLogRecord
        • Obtain logrecord PullLogRecord
        • Search analysis log QueryLogRecord
        • Histogram API QueryLogHistogram
      • Fast Query FastQuery Related Interfaces
        • Create Fast Query CreateFastQuery
        • Update Fast Query UpdateFastQuery
        • Delete Fast Query DeleteFastQuery
        • Get Fast Query Details DescribeFastQuery
        • Get Fast Query List ListFastQuery
      • Index Related APIs
        • Create Index
        • Update Index
        • Delete Index
        • Describe Index
      • Log Shipper LogShipper Related Interfaces
        • Create Log Shipper
        • Update Log Shipper
        • Set Single Log Shipper Status
        • Delete Single Log Shipper
        • Bulk Delete Log Shipper
        • List Log Shipper Records
        • List Log Shipper
        • Bulk Set Log Shipper Status
        • Get Log Shipper
      • Alarm-Related Interfaces
        • CreateAlarmPolicy
        • UpdateAlarmPolicy
        • DeleteAlarmPolicy
        • ValidateAlarmCondition
        • ValidateAlarmPolicySQL
        • EnableAlarmPolicy
        • DescribeAlarmRecord
        • DisableAlarmPolicy
        • DescribeAlarmPolicy
        • ListAlarmPolicy
        • ListAlarmRecord
        • ListAlarmExecutionStats
        • ListAlarmExecutions
      • LogStore Template-Related Interfaces
        • CreateLogStoreTemplate
        • UpdateLogStoreTemplate
        • DeleteLogStoreTemplates
        • DescribeLogStoreTemplates
        • DescribeLogStoreTemplate
      • Download Log Download Related Interfaces
        • Create Download Task CreateDownloadTask
        • Get Download Task List ListDownloadTask
        • Delete Download Task DeleteDownloadTask
        • Get Download Task Address GetDownloadTaskLink
        • Get Download Task Details DescribeDownloadTask
      • LogAlarm Related Interfaces
        • SetLogAlarmStatus
        • deleteLogAlarm
        • createLogAlarm
        • listLogAlarm
        • updateLogAlarm
        • BulkDeleteLogAlarm
        • PreviewAlarmLogRecord
        • getLogAlarm
        • BulkSetLogAlarmStatus
      • Transmission Task Related Interfaces
        • Create Task CreateTask
        • UpdateTask
      • Interfaces Compatible with Elasticsearch
        • ResolveIndex
        • FieldCaps
        • TermsEnum
        • AsyncSearch
    • SDK Reference
      • Go SDK
        • Overview
        • Initialization
        • Version Release Records
        • Project Operations
        • LogStore Operations
        • Install the SDK Package
        • LogStream Operations
        • LogRecord Operations
        • FastQuery Operations
        • LogShipper Operations
        • Index Operations
        • Download Task Operations
      • Java SDK
        • Overview
        • Install the SDK Package
        • LogRecord Operations
      • iOS SDK
        • Overview
        • Quick start
        • Version Release Records
      • Android SDK
        • Overview
        • Quick start
        • Version Release Records
      • Android & iOS SDK Download
      • SDK Privacy Policy
      • SDK Developer Personal Information Protection Compliance Guide
    • Importing SLS Collection Configuration
  • FAQs
    • Common Questions Overview
    • Fault-related questions
    • Configuration-related questions
  • Log Service Level Agreement SLA
  • Document center
  • arrow
  • BLS
  • arrow
  • Best Practices
  • arrow
  • Use BLS via Grafana
Table of contents on this page
  • Operation scenarios
  • Prerequisites
  • Operation steps
  • Step I: Install BLS plugin to Grafana.
  • Step II: Configure data source
  • Step III: View data in Grafana
  • How to use the configuration logstore variables
  • How to use variables to filter log data

Use BLS via Grafana

Updated at:2025-11-03

Operation scenarios

Baidu Log Service (BLS) integrates with Grafana, enabling logstore data to be displayed through Grafana. This document provides guidance on installing and configuring Grafana.

Prerequisites

For installation of Grafana version 8.0 or above, please refer to documents on Grafana official website for specific operations. If Grafana version is lower than 8.0, configuration backup and upgrade are required. Please refer to the Grafana Upgrade Guide for details.

Operation steps

Step I: Install BLS plugin to Grafana.

The steps to install the log service plugin for Grafana are as follows:

  1. Download the BLS plugin.

Download address: https://bls-grafana-datasource.bj.bcebos.com/latest/baidubcebls-datasource.zip

  1. Execute the following command to decompress the log service plugin package into the Grafana plugin directory.
  • Grafana installed through YUM or RPM:

unzip baidubcebls-datasource-master.zip -d /var/lib/grafana/plugins

  • Grafana installed via a .tar.gz file: {PATH_TO} represents Grafana's installation path.

unzip baidubcebls-datasource-master.zip -d {PATH_TO}/grafana-8.0.6/data/plugins

  1. Modify the Grafana configuration file.

(1) Position of configuration file

  • Grafana installed through YUM or RPM:/etc/grafana/grafana.ini
  • Grafana installed through the file .tar.gz: {PATH_TO}/grafana-8.0.6/conf/defaults.ini

(2) Set the parameter allow_loading_unsigned_plugins in the [plugins] node of the configuration file.

allow_loading_unsigned_plugins = baidubcebls-datasource

  1. Restart Grafana.

systemctl restart grafana-server

Step II: Configure data source

Click on Add Data Source on the Data Sources page.

image.png

Select Baidu Log Service data source, and configure the data source according to the following instructions

image.png

  • Name: set the data source name
  • Endpoint: bls address
  • AK and SK: fill in after obtaining the security certification under the Baidu AI Cloud console account

Step III: View data in Grafana

  • Enter Grafana-Dashboard, and click Add Chart to enter the Chart Configuration page as follows:

image.png

  • Log project and logstore: Select the Baidu Log Service plugin as the data source and choose the target log project and logstore.
  • Query statement: Enter a query into the search field and click "Flush" in the top-right corner to view the statistical chart results.
  • Legend: users can customize the legend contents, such as host1-{{host}}, and the field value content is obtained through{{维度字段}}. If only constants are written, all legends are constant content; if the written dimension field is wrong, an error will be displayed; if it is empty, the default legend content will be displayed.
  • Dimension: fields of string and bool types are obtained as dimensions by default, and fields of numerical type can be customized as dimensions, such as Status. At this time, all dimension fields need to be filled in, and multiple fields are separated by commas.
  • Chart format: for the query results containing timestamp fields, the system will display data in a timeseries format by default, or the original data in a Table format. For example, select * contains a time field, so the Table format shall be selected or an error will be displayed. To configure a pie chart, the Pie format shall be selected; otherwise the legend configuration is invalid.
  • Time column: displayed when the chart format is timeseries. The system obtains the timestamp field as the time column by default. If the system obtains it incorrectly, a field can be customized as the time column.

Example of statement for drawing sequence charts

select histogram(cast(@timestamp as timestamp), interval 1 minute) as t, count(*) where path!='' group by t limit 10000

Example of statement for drawing pie charts: notice the chart configuration item Value Options - show on the right, and select All values:

select uid, count(*) as cnt group by uid order by cnt desc limit 10

How to use the configuration logstore variables

In Grafana variable configuration, you must select the Custom type. The name field serves as a unique identifier and must contain the 'logstore' string, which is case-insensitive.

image.png

In the chart configuration API, select the logstore variable for the logstore, and enter the specific logstore in the above logstore variable input box. You need to input the logstore (project), and either Chinese or English parentheses are acceptable (but must be consistent, either all Chinese or all English), e.g., logstore1(project1). Refresh to retrieve data.

image.png

How to use variables to filter log data

Configure variables in Grafana and embed them into the chart query. By selecting different variable values, you can filter the chart data. Here's an example using the user’s "Method" filter configuration:

image.png

  • Go to the Variables menu in the Grafana dashboard configuration and select "New Variables."
  • Set the Variable type to "Query."
  • In the Query options, select the Baidu Log Service plugin in the DataSource dropdown.
  • The query service type is log service, and the query statement is as follows (take method as an example, and replace it with the target field in the actual use):

* | select method limit 1000

  • (Optional) For selection options, check multiple selection and all selection; the default value of all selection is *
  • Insert the variable ${method} into the statement to complete the configuration.

image.png

Previous
BLS Integration with Kibana
Next
Development Guide