I have the following:
remsh $host -n 2>>syslog_issue_list.txt grep -i -e "EMS" -e "error" -e "warning" -e "excessive" /var/adm/syslog/syslog.log |
awk /"$DATE1"/ | awk -vhost="$host" '!/remsh|telnetd/{print host "\n", $0 >> "syslog_issue_list.txt"}'
I am creating a health script that has numerous health checks in it. This check is looking at a remote host's syslog for certain words (EMS, error, etc..). I am then using awk to print the hostname of the remote host and then errors that i searched for in the syslog.
As you can see, I redirected stderr to syslog_issue_list.txt in order to catch certain errors which did not show up in teh awk statement. I was wondering if it is possible to redirect stderr, to that file, and then immediately put in before/after the syslog_issue_list.txt file the hostname that is producing the error.
For example, the redirection will show errors like this:
remshd: Login Incorrect
I have dozens of hosts to check and I will have no clue which host created that error entry. I would like the stderr redirect to the error log to show:
HOSTNAME remshd: Login Incorrect
Anyone have any ideas? Thanks