Bash: check for multiple occurrences within a given time frame -


i looking way have script check multiple occurrences of line report true if happened in 5 or 10 minute interval anywhere in file.

#!/bin/bash   var1=$(/bin/grep -i 'string match' /var/log/logfile.log | wc -l)  if [ "$var1" -ge 10 ];  echo " string match exceeded 10 times" exit 2 fi 

so basically, if see 10 or more string matches occur anywhere in logfile long occurred within 5 minutes of each other need change or add?

fyi logfile date format looks this:

2016-06-01 18:58:00.307 

i not sure 3 digit # appended end of date.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo