I am looking for a way to have a script check for multiple occurrences of a line but only report true if it happened say in a 5 or 10 minute interval anywhere in the file.
#!/bin/bash
VAR1=$(/bin/grep -i 'string match' /var/log/logfile.log | wc -l)
if [ "$VAR1" -ge 10 ]; then
echo " String Match exceeded 10 times"
exit 2
fi
So basically, if I see 10 or more string matches that occur anywhere in the logfile as long as they all occurred within 5 minutes of each other what would I need to change or add?
FYI my logfile date format looks like this:
2016-06-01 18:58:00.307
I am not sure what that 3 digit # is appended to the end of the date.