I have a log file, which has data in the following format
[1361991081] SERVICE NOTIFICATION: qreda;qa-hadoop1;CPU Load;CRITICAL;notify-service-by-email;CRITICAL - load average: 18.29, 18.14, 18.10
[1361991371] SERVICE NOTIFICATION: qreda;CRITICAL-SERVICES_FOR_LAST_24_HOURS;qa-hadoop1:Critical Services;CRITICAL;notify-service-by-email;CPU Load,Memory,
[1361994681] SERVICE NOTIFICATION: qreda;qa-hadoop1;CPU Load;CRITICAL;notify-service-by-email;CRITICAL - load average: 18.02, 18.06, 18.11
[1361994971] SERVICE NOTIFICATION: qreda;CRITICAL-SERVICES_FOR_LAST_24_HOURS;qa-hadoop1:Critical Services;CRITICAL;notify-service-by-email;CPU Load,Memory,
I contains all the data for the past 7 days.I want to grep this file to show the logs for yesterday. Here date is showing as timestamp. I am using the following command
cat /usr/local/nagios/var/nagios.log |grep qa-hadoop1|grep CRITICAL|grep NOTIFICATION | awk -F, '{ if ($1>"[1361989800]" && $1<"[1362076199]") print }'
where 1361989800
is the calculated timestamp value for Thu Feb 28 00:00:00 IST 2013
and 1362076199
is the calculated timestamp value for Thu Feb 28 23:59:59 IST 2013
.
This works well but the problem is how do i pass 1361989800
and 1362076199
as arguments??