If you were to relax the requirement of the last 10 minutes, and use GNU coreutils and grep, this is pretty easy:
tail -f -s 60 -n +0 file.txt | grep -m 1 pattern
Tail the entire file by starting on line zero (-n +0
), poll it every -s
seconds, and grep stops after -m
matches.
For a one-off interactive search, I wouldn't bother date parsing, and would at first manually change the starting line with the tail -n
. Date parsing could be by writing a script in your favorite script language with a decent module for that (Python, Perl).
Finally, if you want a search engine for your logs, look to implment event management systems like Graylog, ELK, Splunk, Log Insight, LogRhythm etc.