Hello, I am using the below ssh script for my ssh script sensor to grep error messages in log. however this give me error - response not well-formed (code pe132) . Cam someone help in this.
script is as below.
#!/bin/bash # definethe log path LOG_FILE="/var/log/messages" #read the last 100 lines of the log file and search for the keyword "error" ERROR=$(tail -n 100 "$LOG_FILE" | grep "error") #count the number of error occurences ERROR_COUNT=$(echo "$ERRORS" | wc -l) # output the error count to stdout echo "ERRORS:$ERROR_COUNT" # output the error messages to stdout echo "$ERRORS" | while read -r line; do echo "ERROR: $line" done
Add comment