Skip to main content

Exception Field Extraction

Add custom field extraction rules for exception messages to refine error classification dimensions, surface business error codes for faster troubleshooting, and support business observability outcomes. Extracted fields are appended to the exception class name in a fixed format, enabling finer-grained error reasons for aggregation in Error Analysis. No application code changes are required—parsing uses the exception message text already collected by the agent.

tip

Requires SmartAgent ≥ 10.3.0. Field extraction performs deeper parsing of exception messages and may slightly increase execution time. To limit performance impact, each service supports a maximum of 10 extraction rules. To configure request error status codes, go to Anomaly Identification → Error Status Code.

Entry Point

Navigate to Deployment Configuration → Rule Configuration → Data Collection → Exception Collection → Exception Field Extraction.

This page shares the Exception Collection module with Excluded Exception; switch via the top tabs. The list shows priority, description, and enable status, and supports search by description.

1784535001772

ActionDescription
CreateAdd an extraction rule
EditModify an existing rule
MoveChange rule priority order
DeleteRemove a rule
Enable / DisableControl whether the rule takes effect
info

A smaller priority number means higher priority. Each error record is matched in priority order; only the first matching rule applies—rules are not stacked.

Configure an Extraction Rule

Click Create to open the configuration drawer on the right.

1784535027655

1. Effective Scope

Select a scope for the rule:

ScopeDescription
All validApplies to all services; no further selection required
Local validApplies only to the selected scope; at least one object is required

Select a scope

Local valid supports Service, Service tags, Process group, and Process group tags (multi-select). Multiple condition rows can be combined with And / Or.

Local valid scope

2. Configuration Item

Define which exceptions this rule applies to.

Exception Class Name

OperatorDescription
AllNo class name filter; the class name input is hidden
Include / ExcludeClass name contains or does not contain the specified string
Equals / Not equal toExact match (including package path)
Start from / End atClass name starts or ends with the specified string

Message Contents

Further filter by message content after class name matching:

  • When Exception Class Name is All, Message Contents is fixed to Include, and a match string is required
  • When Exception Class Name is not All, choose Include or Any; Any skips content filtering

When Exception Class Name is All:

Message Contents configuration

When an operator other than All is selected, enter the class name (including package path if needed, e.g. com.br.TraceController). Message Contents can be set to Any:

Include configuration

3. Field Extraction

Configure fields to extract from the exception message. The splicing format is fixed:

ExceptionClassName[fieldName=fieldValue][fieldName=fieldValue]

Example:

RealTimeException[errorCode=12000035][errTip=registration info mismatch]

Rules:

  • Multiple fields are concatenated in configuration order
  • If a field value is empty, that [fieldName=fieldValue] segment is skipped
  • If all fields are empty, the original exception class name is kept
  • Concatenated error reasons longer than 512 characters are truncated
  • Each rule supports up to 10 extraction fields and must keep at least one
FieldDescriptionRequired
Extracted Field NameName shown in the result, such as errorCode or errTipYes
Prefix DelimiterMarks the start of extraction; value starts after this string, e.g.errorCode='Yes
Suffix DelimiterMarks the end of extraction; if empty, extraction continues to line end or text endNo

Click + Add Field to add more extraction items.

Field Extraction

4. Debug Preview

Paste a real exception message into Error Message Sample to preview the extraction result in real time. Samples are used only for local preview and are not stored or reported.

Debug Preview

Example configuration (extract errorCode):

FieldValue
Extracted Field NameerrorCode
Prefix DelimiterErrorCode(errorCode='
Suffix Delimiter'

Sample:

RealTimeException{errorCode='null', errorCodeEnum=ErrorCode(errorCode='12000035', errTip='Registration info mismatch')}

Preview result:

RealTimeException[errorCode=12000035]

If no field is matched, check that the prefix and suffix delimiters match the original message text.

Full configuration and preview example:

Debug preview result

5. Description

Enter a description for the rule. It appears in the list Description column for search and management.

Description

Click Save when finished.

Effect After Configuration

After rules take effect, Error Analysis and related pages automatically show the refined error reasons—no extra setup is needed.

Before

RealTimeException    3,892  45.2%

After

RealTimeException[errorCode=12000035][errTip=registration info mismatch]    2,105
RealTimeException[errorCode=12000021][errTip=unauthorized] 987
RealTimeException[errorCode=12000088][errTip=resource not found] 800
  • Errors that match an extraction rule are split into finer-grained entries
  • Errors that match no rule remain unchanged
  • Error detail titles, trends, and counts aggregate by the refined error reason

In the Error Analysis list, refined error reasons appear in the Error Cause column:

1784536653705

On the Error Details page, the title shows the full concatenated result; trends and error lists aggregate by that refined reason:

1784536582021

Click View Log to see the original exception message and stack trace in the error log:

1784536602323

Notes

warning

Field extraction adds some agent overhead; configure rules only for exceptions that need finer classification, and keep enabled rules under control.