(Optional) Masking Fault Logs
You can add a masking rule that contains fault keywords to prevent information containing fault keywords from being recorded in the file after cleaning logs. By default, the system saves masking rules that contain fault keywords in ${HOME}/.ascend_faultdiag/custom-blacklist.json.
- Currently, only ERROR-level logs of CANN App logs can be masked.
- If you need to customize a path for storing the file that contains masking rules for fault keywords, see Customizing the Home Directory of MindCluster Ascend FaultDiag.
Procedure
- Add a masking rule. For example, you can run the following command to filter out logs containing "ERROR" and "FUSION".
ascend-fd blacklist --add ERROR FUSION
- A keyword can contain a maximum of 200 characters, including uppercase letters, lowercase letters, digits, and special characters, such as hyphens (-), periods (.), and slashes (/).
- A masking rule supports a maximum of 10 keywords. Multiple keywords can be separated by spaces, for example, ERROR FUSION, ERROR "FUSION", or "ERROR" "FUSION".
- If a keyword contains a backslash (\), the entire keyword must be enclosed in quotation marks to prevent the backslash from being ignored, for example, "ERR\OR".
- A maximum of 50 masking rules can be saved. If the number of masking rules exceeds 50, the system discards the earliest masking rule and retains the newest one.
- Import a masking rule using a JSON file.
ascend-fd blacklist --file test.json /Path of the test.json file
If you add a masking rule by importing a JSON file, the imported JSON file will overwrite the original JSON file in the system.
The JSON file format is as follows:{ "blacklist":[["ERROR2","ERROR3","ERROR3"], ["ERR1","ERR2","ERR3","ERR4"] ] } - View existing masking rules.
ascend-fd blacklist --show
Command output:[BLACKLIST] 0. 'ERROR', 'FUSION' 1. 'ERROR2', 'ERROR2', 'ERROR3' 2. 'ERR1', 'ERR2', 'ERR3', 'ERR4'
- (Optional) Delete a masking rule, for example, rule 0. Multiple rules can be deleted at a time. Use spaces to separate them.
ascend-fd blacklist --delete 0
Parent topic: Instructions