Log query

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
  • Operation guide
  • arrow
  • Query analysis
  • arrow
  • Log query
Table of contents on this page
  • Log query
  • Index configuration
  • Bar chart
  • Query analysis
  • 1. Log Search module
  • 2. SQL query analysis

Log query

Updated at:2025-11-03

Log query

Log query is used to query and analyze the data content of existing LogStore. Baidu AI Cloud Log Service (BLS) provides a comprehensive data query and analysis syntax. For details, refer to [Search Syntax]

  1. Sign in to the Baidu AI Cloud official website, click Management Console in the top-right corner to quickly access the console interface.
  2. Go to Product Service > Baidu Log Service (BLS) and navigate to Query Analysis -> Log Query page.

image.png

  1. Select logstore, logstream and time range, enter search or SQL statements in the statement edit box, or reference SQL statement in the example, click Query to execute the query statement, and return the results and display them below.

    • LogStore Selection: Choose from user-created LogStores in the current region or manually input a LogStore name to filter.
    • Logstream Selection: Specify the logstream within the chosen LogStore. Leave blank to query all logstreams.
  2. Auto-refresh: By default, data query results do not auto-refresh. Once the auto-refresh period is set, the query statement will be executed automatically at defined intervals.
  3. Quick actions
Function Description
Favorite statements If you frequently need to view the data results of this query, click Favorite button to store the current data query in your favorites. Enter favorites to automatically execute query statements and display results.
Historical records Click the History Records Pop-up to quickly select recently queried statements, automatically execute the query statements, and display the results.
Share link Support sharing link
Quick jump alarm Click the Jump Alarm icon to bring logstore, and the query statement can quickly redirect to the Alarm Creation page to configure the alarm
Support log association redirection Support log association redirection, allowing redirection to modules such as transmission task, delivery management, scheduled SQL analysis, and alarm management associated with the LogStore
Real-time logs Support viewing real-time logs with highlighting or filtering specific content

Index configuration

On the Log Query page, you can enable log indexing. Once enabled, keyword searches can be performed on log fields, with SQL queries executed on the search results.

  1. After clicking Index Configuration, you can directly enable full-text indexing or add key indexing
  2. Automatically obtain the field list by simply enabling the index switch. If the desired field is not in the list, click Add Field to customize (Note: Custom-added fields without enabled indexing will not be displayed during subsequent edits)
  3. After opening the index, you can set the field name, data type, word separator, case sensitivity, inclusion of Chinese, etc.

    • Supported data types: string/long/float/bool
    • For json-formatted string fields, indexes can be configured in the a.b.c format. For example, message:{"client":"conn281","doc":{"application":{"name":"MongoDB Shell"},"driver":{"result":true}}}, the message.doc.driver index can be configured, and then message.doc.driver can be searched
    • The word separator splits the full text of logs into several tokens for search, supporting only English symbols and \n\t\r
    • Case Sensitivity: Determine whether searches are case-sensitive. For instance, if the log is level:Error, a case-sensitive search using level:error will not retrieve the log.
    • Chinese Content: Enable this feature for fields containing Chinese text. For example, if the log is labeled Baidu AI Cloud, you cannot retrieve it by searching "Baidu" unless this feature is enabled. Once enabled, searching "Baidu" will retrieve the log.
    • Json dynamic index: 1. For Json-type fields, you can enable the Json dynamic index switch, which will automatically index all fields in the first three layers of the Json field. 2. The dynamic index subfield only supports match to search field values, that is, it supports key.key1:value1 search, but it does not support key:key1 search. 3. The dynamic index subfield does not support select subfield query, that is, it does not support select key.key1 query.

image.png

Bar chart

The log distribution histogram displays the time distribution of queried logs. Hovering over the histogram shows the time and log count for each bar.

image.png

Query analysis

After enabling indexing, BLS supports log search via Query or SQL query analysis. See Search Syntax for details.

Query statements support three formats, such as:

  • match search statement: Search log content based on conditions. match is a search syntax keyword (Note: The search statement in match must be configured with relevant indexes. For example, match GET for full-text search requires full-text indexing, match method:GET for field search requires corresponding field-level index, and match * currently requires either full-text indexing or field-level index)
  • SQL statement: Execute SQL statement
  • match search statement | SQL statement: Execute SQL statements on the result set that meets the query conditions, with the query statement and SQL statement separated by a vertical bar (Note: If there is a query statement before select, the queried content needs to be configured with relevant indexes; otherwise, an error will be reported)

1. Log Search module

image.png

Function Description
Search 1. Manually enter a query statement
2 Support interactive query, allowing search syntax configuration via form selection. Single search conditions support AND, OR, and condition group configurations. Multiple search conditions can be configured, with an AND relationship between them
Support expanding long fields By default, long fields exceeding 1000 characters will be collapsed, and the expansion and collapse of long fields can be globally configured
Support expanding JSON fields By default, JSON fields are displayed as long strings. Click to expand JSON fields into a tree view, with one layer of structure expanded by default, such as message field
!
Field list 1. Available fields: Retrieve the latest 20 log fields and all configured index fields (parent-child hierarchical index fields will be displayed in available fields, dynamic index child-level fields will not be displayed)
2. Display fields: Click fields in the available fields list to add them to display fields, and only the logs added to display fields will be shown on the right.

3. Index fields support quick statistical analysis of logs
Context log browsing Support viewing the context information of specified logs in the original file, highlighting or filtering specific content
Data Download To download query results data locally, click Download to obtain log data in JSON or CSV format

2. SQL query analysis

Execute SQL queries directly without search conditions

image.png

SQL queries can be executed on the basis of search results.

image.png

Previous
Log Collection
Next
SQL Syntax