Originally Posted by 24x7servermanagement
You can do one thing, copy those 4000+ terms in a text file (/root/a.txt) and use for command to search a term in the log file.
For ex :-
for i in `cat /root/a.txt` ; do grep $i /var/log/messages; done
Wrong. Did you bother to read the man page on the grep command?? If so, did you happen to see the -f flag, which lets you use a file as the input pattern??
And you're the Chief Technical Office
OP: Your solution would work just fine, since you're doing it recursively, with the -f flag.