Field value extraction functions

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
  • Data processing
  • arrow
  • Data processing
  • arrow
  • Data processing
  • arrow
  • Field value extraction functions
Table of contents on this page
  • Introduction
  • e_regex function
  • Function definition
  • Syntax description
  • Parameter description
  • Example
  • e_json function
  • Function definition
  • Syntax description
  • Parameter description
  • Example
  • e_sep function
  • Function definition
  • Syntax description
  • Parameter description
  • Example
  • e_csv function
  • Function definition
  • Syntax description
  • Parameter description
  • Example
  • e_psv function
  • Function definition
  • Syntax description
  • Parameter description
  • Example
  • e_tsv function
  • Function definition
  • Syntax description
  • Parameter description
  • Example
  • e_kv function
  • Function definition
  • Syntax description
  • Parameter description
  • Example

Field value extraction functions

Updated at:2025-11-03

Field value extraction functions

Introduction

A common use case of key-value extraction functions is shown in the following figure. After processing into structured data, it can be further used in SQL analysis scenarios.

e_regex function

Function definition

Get the field value and return the corresponding string.

Syntax description

Text
1e_regex(field, regex, fields_info=None, mode="fill-auto", pack_json='')

Parameter description

Parameter name Parameter description Parameter type Required or not Parameter default Parameter range
field The field name to be extracted String Yes - -
regex Regular expression String Yes - -
fields_info The target field name after matching. This parameter must be configured when the regular expression parameter does not configure the name of the named capture. List<Table> No - -
mode Field overwriting mode. The default is fill-auto String No overwrite fill/fill-auto/add/add-auto/overwrite/overwrite-auto
pack_json Pack all matching results of the regular expression into the field specified by pack_json. The default value is empty, indicating no packing. String No - -

Example

  • Example 1

Original log:

Text
1{"content": "1234abcd5678"}  

Processing rules:

Text
1e_regex("content", "\d+", [{'target1':'long'}])  

Processing results:

Text
1{"content": "1234abcd5678", "target1": 1234}
  • Example 2

Original log:

Text
1{"content": "1234abcd"}  

Processing rules:

Text
1e_regex("content", "(?<target1>\d+)(.*)", [{'target2':'string'}])  

Processing results:

Text
1{"content": "1234abcd5678", "target1": "1234", "target2": abcd}
  • Example 3

Original log:

Text
1{"content": "1234abcd5678"}  

Processing rules:

Text
1e_regex("content", "\d+", [{'target1':'long'}, {'target2':'long'}])  

Processing results:

Text
1{"content": "1234abcd5678", "target1": 1234, "target2": 5678}
  • Example 4

Original log:

Text
1{"content": "1234abcd5678"}  

Processing rules:

Text
1e_regex("content", "\d+", [{'target1':'long'}, {'target2':'long'}], pack_json='new')  

Processing results:

Text
1{"content": "1234abcd5678", "new": {"target1": 1234, "target2": 5678}}

e_json function

Function definition

Extract field values from JSON.

Syntax description

Text
1e_json(field, depth=100, prefix="", suffix="", fmt="simple", sep=".", mode="fill-auto")

Parameter description

Parameter name Parameter description Parameter type Required or not Parameter default Parameter range
field The field name to be extracted String Yes - -
depth The depth of field expansion. The value range is 1-2000, 1 means only expanding the first layer, the default is 100 layers Int No 100 1~2000
prefix The prefix added to the field name when expanding. String No - -
suffix The suffix added to the field name when expanding. String No - -
fmt Formatting method String No simple -
sep The separator for formatting parent-child nodes. It needs to be set when fmt is full, parent, or root. Default to. String No - simple (default value): indicates using the node name as the field name; full: indicates combining the parent node and the current node as the field name; parent: indicates using the complete path as the field name; root: indicates combining the root node and the current node as the field name
mode Field overwriting mode. The default is fill-auto String No fill-auto fill/fill-auto/add/add-auto/overwrite/overwrite-auto

Example

  • Example 1

Original log:

Text
1{"content": "{\"a\": \"a1\", \"b\": \"b1\"}"}  

Processing rules:

Text
1e_json("content")  

Processing results:

Text
1{"content": "{\"a\": \"a1\", \"b\": \"b1\"}", "a": "a1", "b", "b1"}  
  • Example 2

Original log:

Text
1{"content": "{\"a\": \"a1\", \"b\": \"b1\"}"}  

Processing rules:

Text
1e_json("content", prefix="_", suffix="__")  

Processing results:

Text
1{"content": "{\"a\": \"a1\", \"b\": \"b1\"}", "_a__": "a1", "_b__", "b1"}  

e_sep function

Function definition

Extract field value content based on specified characters (multiple characters).

Syntax description

Text
1e_kv(src_field, fields_info, sep=" ", quote="", restrict=false, mode="fill-auto")

Parameter description

Parameter name Parameter description Parameter type Required or not Parameter default Parameter range
src_field The field name to be extracted String Yes - -
fields_info The target field name after matching. List<Table> Yes - -
sep Separator, not limited to a single character. String No Space -
quote Quote character, used to wrap the value. String No - -
restrict Default value: false When the number of extracted values is inconsistent with the number of target fields input by the user: true: ignore, no extraction processing is performed; false: try to match the first few fields String No false true/false
mode Field overwriting mode. The default is fill-auto String No fill-auto fill/fill-auto/add/add-auto/overwrite/overwrite-auto

Example

  • Example 1

Original log:

Text
1{"content": "a1 b1"}  

Processing rules:

Text
1e_sep('content', [{'a':'string'}, {'b':'string'}])

Processing results:

Text
1{"content": "a1 b1", "a": "a1", "b", "b1"}  
  • Example 2

Original log:

Text
1{"content": "a1 b1"}

Processing rules:

Text
1e_sep('k1', [{'a':'string'}])

Processing results:

Text
1{"content": "a1 b1", "a": "a1"}  
  • Example 3

Original log:

Text
1{"content": "a1 b1"}

Processing rules:

Text
1e_sep('k1', [{'a':'string'}, {'b':'string'}, {'c':'string'}])

Processing results:

Text
1{"content": "a1 b1", "a": "a1", "b", "b1"}  

e_csv function

Function definition

Extract field value content based on specified characters (multiple characters).

Syntax description

Text
1e_csv(src_field, fields_info, sep=",", quote="", restrict=false, mode="fill-auto")

Parameter description

Parameter name Parameter description Parameter type Required or not Parameter default Parameter range
src_field The field name to be extracted String Yes - -
fields_info The target field name after matching. List<Table> Yes - -
sep Separator, not limited to a single character. String No , -
quote Quote character, used to wrap the value. String No - -
restrict Default value: false When the number of extracted values is inconsistent with the number of target fields input by the user: true: ignore, no extraction processing is performed; false: try to match the first few fields String No false true/false
mode Field overwriting mode. The default is fill-auto String No fill-auto fill/fill-auto/add/add-auto/overwrite/overwrite-auto

Example

  • Example 1

Original log:

Text
1{"content": "a1,b1"}  

Processing rules:

Text
1e_csv('content', [{'a':'string'}, {'b':'string'}])

Processing results:

Text
1{"content": "a1,b1", "a": "a1", "b", "b1"}  
  • Example 2

Original log:

Text
1{"content": "a1,b1"}

Processing rules:

Text
1e_csv('k1', [{'a':'string'}])

Processing results:

Text
1{"content": "a1,b1", "a": "a1"}  
  • Example 3

Original log:

Text
1{"content": "a1,b1"}

Processing rules:

Text
1e_csv('k1', [{'a':'string'}, {'b':'string'}, {'c':'string'}])

Processing results:

Text
1{"content": "a1,b1", "a": "a1", "b", "b1"}  

e_psv function

Function definition

Extract field value content based on specified characters (multiple characters).

Syntax description

Text
1e_psv(src_field, fields_info, sep="|", quote="", restrict=false, mode="fill-auto")

Parameter description

Parameter name Parameter description Parameter type Required or not Parameter default Parameter range
src_field The field name to be extracted String Yes - -
fields_info The target field name after matching. List<Table> Yes - -
sep Separator, not limited to a single character. String No | -
quote Quote character, used to wrap the value. String No - -
restrict Default value: false When the number of extracted values is inconsistent with the number of target fields input by the user: true: ignore, no extraction processing is performed; false: try to match the first few fields String No false true/false
mode Field overwriting mode. The default is fill-auto String No fill-auto fill/fill-auto/add/add-auto/overwrite/overwrite-auto

Example

  • Example 1

Original log:

Text
1{"content": "a1|b1"}  

Processing rules:

Text
1e_psv('content', [{'a':'string'}, {'b':'string'}])

Processing results:

Text
1{"content": "a1|b1", "a": "a1", "b", "b1"}  
  • Example 2

Original log:

Text
1{"content": "a1|b1"}

Processing rules:

Text
1e_psv('k1', [{'a':'string'}])

Processing results:

Text
1{"content": "a1|b1", "a": "a1"}  
  • Example 3

Original log:

Text
1{"content": "a1|b1"}

Processing rules:

Text
1e_psv('k1', [{'a':'string'}, {'b':'string'}, {'c':'string'}])

Processing results:

Text
1{"content": "a1|b1", "a": "a1", "b", "b1"}  

e_tsv function

Function definition

Extract field value content based on specified characters (multiple characters).

Syntax description

Text
1e_tsv(src_field, fields_info, sep="\t", quote="", restrict=false, mode="fill-auto")

Parameter description

Parameter name Parameter description Parameter type Required or not Parameter default Parameter range
src_field The field name to be extracted String Yes - -
fields_info The target field name after matching. List<Table> Yes - -
sep Separator, not limited to a single character. String No \t -
quote Quote character, used to wrap the value. String No - -
restrict Default value: false When the number of extracted values is inconsistent with the number of target fields input by the user: true: ignore, no extraction processing is performed; false: try to match the first few fields String No false true/false
mode Field overwriting mode. The default is fill-auto String No fill-auto fill/fill-auto/add/add-auto/overwrite/overwrite-auto

Example

  • Example 1

Original log:

Text
1{"content": "a1\tb1"}  

Processing rules:

Text
1e_tsv('content', [{'a':'string'}, {'b':'string'}])

Processing results:

Text
1{"content": "a1\tb1", "a": "a1", "b", "b1"}  
  • Example 2

Original log:

Text
1{"content": "a1\tb1"}

Processing rules:

Text
1e_tsv('k1', [{'a':'string'}])

Processing results:

Text
1{"content": "a1\tb1", "a": "a1"}  
  • Example 3

Original log:

Text
1{"content": "a1\tb1"}

Processing rules:

Text
1e_tsv('k1', [{'a':'string'}, {'b':'string'}, {'c':'string'}])

Processing results:

Text
1{"content": "a1\tb1", "a": "a1", "b", "b1"}  

e_kv function

Function definition

Extract field values based on two-level separators.

Syntax description

Text
1e_kv(src_field, reg, keyIndex, valueIndex, fields_info=None, mode="fill-auto")

Parameter description

Parameter name Parameter description Parameter type Required or not Parameter default Parameter range
src_field The field name to be extracted String Yes - -
reg The separator string of the regular expression for keywords and values String Yes - -
keyIndex The subscript of the key, indicating which one of the regular expression matching results the key takes Int Yes - -
valueIndex The subscript of the value, indicating which one of the regular expression matching results the value takes Int Yes - -
fields_info The target field name after matching. List<Table> No - -
mode Field overwriting mode. The default is fill-auto String No fill-auto fill/fill-auto/add/add-auto/overwrite/overwrite-auto

Example

  • Example 1

Original log:

Text
1{"content": "a:a1, b:b1"}  

Processing rules:

Text
1e_kv('content', '([a-z]+):([a-z0-9]+)', 1, 2, [{'a':'string'}, {'b':'string'}])

Processing results:

Text
1{"content": "a:a1, b:b1", "a": "a1", "b", "b1"}

Previous
Field operation functions
Next
Log Applications