$ ssh foo@server /usr/local/bin/grep -C 100 "the string you are looking for" /var/log/whatever