I need to search multiple error keywords in Linux real time log files through shell script.
Below is something I tried and works on command line, it needs to be fine tuned or may be a different approach is needed.
Need your help.
grep -En "fatal|error|WARN|fail" /scripts/log.txt --color=auto > /scripts/log/errors_found.txt
mailx -s "Below are the errors found on host $(hostname)" -E email@example.com < /scripts/log/errors_found.txt
Thanks in Advance!