How to capture last 15mins data logged from server.log file?

Below is Script to scan the errorlist file (errorlist file includes a list of errors) with sererv.log file (sererv.log file should contain data of recent 15mins )
but my requirement is I should get the recent logs i.e. cmd to capture only recent 15mins data logged from sererv.log file then scan with errorlist file
Note : sererv.log file date format is 2015-08-28 04:10:00

cat "errorlist" | while read line 
        do
                LINE=`echo $line` 
            echo "$line" >> SCRIPT.line
            grep -i "$LINE" "server.log_date" >> SCRIPT.grep
        done
		fi

Help us help you:

  1. Does your code only have to process 15 minute time periods within a single day, or does it have to handle periods that cross midnight?
  2. How is the 15 minute date range determined? (15 minutes prior to the time your script is invoked? 15 minutes prior to the last entry in sererv.log ? Anything later than a command line argument? Something else?)
  3. Please show us a sample errorlist file (in CODE tags).
  4. Please show us a sample sererv.log file (in CODE tags).
  5. Please show us exactly what should appear in SCRIPT.line (in CODE tags) after your script runs with the sample input files you specified.
  6. Please show us exactly what should appear in SCRIPT.grep (in CODE tags) after you script runs with the sample input files you specified.
  7. Please show us exactly (in CODE tags) what other output you want your script to produce.
  8. What operating system and shell are you using?
  9. Is the output saved in SCRIPT.line supposed to be a running list from all invocations of your script (as shown in your sample code), or is it just supposed to be a copy of errorlist from the current invocation of your script?
  10. Is the output saved in SCRIPT.grep supposed to be a running list from all invocations of your script (as shown in your sample code), or is it just supposed to the grep output from the current invocation of your script?
1 Like

solved

Hello maniohar2013,

Can you tell us how you solved it? Someone may find this thread useful for a similar need.

Thanks, in advance,
Robin