I have following grep command which looks for 'Exception in' string in the logs for past 24 hours via remote machine and prints out next 40 lines.
ssh $host $'sed -e "1,/^$(date -d -20hour +\'%Y-%m-%d %H\')/d" /mylogs.out | grep -A40 "Exception in"' >> $log
2016-02-08 13:19:34,034 ERROR [qtp859655531-3974] com.project.actions.CustomStatsAction - Exception in .....
2016-02-08 13:19:34,034 WARN [qtp859655531-3974] com.project.actions.CustomStatsAction - Exception in ....