LogStore Operations

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
  • Development Guide
  • arrow
  • SDK Reference
  • arrow
  • Go SDK
  • arrow
  • LogStore Operations
Table of contents on this page
  • Create logstores
  • Update the specified logstore
  • Query the specified logstore
  • Get logstore list
  • Bulk obtain logstore details
  • Delete logstores

LogStore Operations

Updated at:2025-11-03

Create logstores

To create and name logstores, the following guidelines shall be met:

  • Logstore names must be unique per account and per region
  • The logstore name shall not be longer than 128 characters.
  • Only the following characters can permitted for logstore names: a-z, A-Z, 0-9, “_”, “-”, “.”
  • The logstore retention period can be set to a maximum of 3,650 days, indicating permanent retention. Unit: days.

Use the following code to create a LogStore and specify its retention period.

Go
1createLogStoreRequest := CreateLogStoreRequest{
2    Project:      "default",
3    LogStoreName: "test",
4    Retention:    1,
5}
6err := BLS_CLIENT.CreateLogStoreV2(createLogStoreRequest)
7if err != nil {
8  fmt.Println("Create logStore failed: ", err)
9} else {
10  fmt.Println("Create logStore success.")
11}

If you need to bind a tag when creating a LogStore, use the following code to set it up.

Go
1tag := model.TagModel{
2    TagKey:   "key",
3    TagValue: "value",
4}
5tags := []model.TagModel{tag}
6createLogStoreRequest := CreateLogStoreRequest{
7    Project:      DefaultProject,
8    LogStoreName: "sdk-logstore-test",
9    Retention:    1,
10    Tags:         tags
11}
12err := BLS_CLIENT.CreateLogStoreV2(createLogStoreRequest)
13if err != nil {
14  fmt.Println("Create logStore failed: ", err)
15} else {
16  fmt.Println("Create logStore success.")
17}

Prompt:

  • Detailed parameter configuration and restrictions may refer to BLS API document Create Logstore

Update the specified logstore

With following codes, update the specified logstore, and currently support updating the associated retention period.

Go
1updateLogStoreRequest := UpdateLogStoreRequest{
2    Project:      "default",
3    LogStoreName: "test",
4    Retention:    2,
5}
6err = BLS_CLIENT.UpdateLogStoreV2(updateLogStoreRequest)
7if err != nil {
8  fmt.Println("Update logStore failed: ", err)
9} else {
10  fmt.Println("Update logStore success.")
11}

Prompt:

  • Detailed parameter configuration and restrictions may refer to BLS API document Update LogStore

Query the specified logstore

With following codes, get the specified logstore details.

Go
1describeLogStoreRequest := DescribeLogStoreRequest{
2    Project:      "default",
3    LogStoreName: "test",
4}
5res, err := BLS_CLIENT.DescribeLogStoreV2(describeLogStoreRequest)
6if err != nil {
7  fmt.Println("Get logStore failed: ", err)
8} else {
9  fmt.Println("LogStore info: ", res)
10}

Prompt:

  • Detailed parameter configuration and restrictions may refer to BLS API document Describe Logstore

Get logstore list

With following codes, obtain the logstore list of the current user.

Go
1//Optional parameter list
2listLogStoreRequest := ListLogStoreRequest{
3  Project:     "default"
4  NamePattern: "bls-log",
5  Order:       "asc",
6  OrderBy:     "creationDateTime",
7  PageNo:      1,
8  PageSize:    10}
9res, err := BLS_CLIENT.ListLogStoreV2(listLogStoreRequest)
10if err != nil {
11  fmt.Println("Get logStore list failed: ", err)
12} else {
13  fmt.Println("List logStore success: ", res)
14}

Prompt:

  • Detailed parameter configuration and restrictions may refer to BLS API document List Logstore

Bulk obtain logstore details

With following codes, bulk obtain the logstore details of the current user

Go
1//Optional parameter list
2batchRequest := bls.BatchLogStoreRequest{
3		LogStores: []bls.BaseLogStore{
4			{
5				Project:      "default",
6				LogStoreName: "bls-test",
7			},
8		},
9	}
10	res, err := BLS_CLIENT.GetLogStoreByProjects(batchRequest)
11	if err != nil {
12		fmt.Println("Batch get logStore failed: ", err)
13	} else {
14		fmt.Println("Batch get logStore success: ", res)
15	}

Prompt:

  • Detailed parameter configuration and restrictions may refer to BLS API document Batch Get Logstore

Delete logstores

With following codes, delete the specified logstore and permanently erase all associated logstores that have been stored.

Go
1deleteLogStoreRequest := DeleteLogStoreRequest{
2    Project:      "default",
3    LogStoreName: "test",
4}
5err = BLS_CLIENT.DeleteLogStoreV2(deleteLogStoreRequest)
6if err != nil {
7  fmt.Println("Delete logStore failed: ", err)
8} else {
9  fmt.Println("Delete logStore success.")
10}

Prompt:

  • Detailed parameter configuration and restrictions may refer to BLS API document Delete Logstore

Previous
Project Operations
Next
Install the SDK Package