"grep: ascend-dmi*.log: binary file matches" Is Displayed When "grep ${Keyword} -rn /var/log/ascend-dmi/ascend-dmi*.log" Is Executed

Symptom

When grep ${Keyword} -rn /var/log/ascend-dmi/ascend-dmi*.log is executed, the message "grep: ascend-dmi*.log: binary file matches" is displayed, as shown in the following figure.

Possible Causes

If the process is forcibly terminated or the server undergoes a hard reboot during log write operations, log data residing in the kernel buffer may not be fully flushed to the drive. Consequently, the resulting log file may contain \0, appearing as binary NULL characters, as shown in the following figure.

In this case, logs can still be recorded and viewed, as shown in the following figure.

Solution

Run the grep ${keyword} -rna /var/log/ascend-dmi/ascend-dmi*.log command to search for the log file containing the specified keyword, as shown in the following figure.