Log Event Subscription
Interface Name
Log event subscription
Application Phase
Subscription phase
API Prototype
result1_value, result2_description = ops.iclog.subscribe(tag, moduName, logLevel, infoAlias, logInfo)
Description
Parameter |
Description |
Value |
---|---|---|
tag |
Indicates conditions. |
The value is a string of 1 to 12 case-insensitive characters, consists of letters, digits, and underscores (_), and starts with a letter. The value cannot be one of the following: "", None, and, or, andnot. The value cannot contain \0. |
moduName |
Indicates a log module name. |
The value is a string of 0 to 31 case-sensitive characters and cannot contain \0. |
logLevel |
Indicates the log level. |
The value is an integer that ranges from 0 to 7. The default value is None, indicating that the log level is not matched. |
infoAlias |
Indicates a log alias. |
The value is a string of 0 to 31 case-sensitive characters and cannot contain \0. |
logInfo |
Indicates log information. |
The value is a string of 0 to 255 case-sensitive characters and cannot contain \0. |
Return Value
The result1_value and result2_description in the API prototype indicate return values.
The result1_value is the first return value, 0 indicates success, and 1 indicates failure.
The result2_description is the second return value, indicating the failure cause. It is returned only when the first return value is 1.
Usage Description
If multiple simple events are defined using the ops.iclog.subscribe API in the subscription phase, but the simple events are not combined through the Multi-Condition Combination API, the Python script assistant cannot be configured.
The log event subscription matches a specified log.
Example
When the log "AAA/6/LOCALACCOUNT_DELETE:Local account [huawei] has been deleted." is generated on the device, the corresponding action is triggered.
value, descri_str = ops.iclog.subscribe("AAA_log", "AAA", 6, "LOCALACCOUNT_DELETE", "Local account [huawei] has been deleted.")