Mallikarjuna
IS-IT--Management
I have some requirement of filtering the logs according to the time stamp (indicated the log file in the example). This file is keep growing with time stamp. My requirement is to redirect the file to output file at regular intervals. I want the file to be generated only during that interval.
For example, let us say if I run the script at 14:00:00 hrs, I should see the data from 13:45 to 14:00 hrs only.
Similarly, If I run the script at 14:15:00 hrs, I want to see the data from 14:00:00 hrs to 14:00:15 hrs and so on.
I was told that awk and sed commands would help in achieving this. Please give me the solution for the above requirement.
Thanks in advance.
Input file:
==================================
Oct 14 13:46:59:Oct 14 13:47:00 DHCPCBP BROWSER[0000]: The browser was unable to
retrieve a list of servers from the browser master \\SCDEMO8 on the network Device\Nbf_{A3F66BC5-CD4C-466E-9F61-C0A804FF1361}. The data is the error code.
Oct 14 13:47:10:Oct 14 13:48:55 DHCPCBP BROWSER[0000]: The browser service has f
ailed to retrieve the backup list too many times on transport \Device\Nbf_{A3F
66BC5-CD4C-466E-9F61-C0A804FF1361}. The backup browser is stopping.
Oct 14 14:01:04:Oct 14 14:02:44 DHCPCBP Norton_AntiVirus[0000]: Scan start
ed on selected drives and folders and all extensions.
Oct 14 14:02:14:Oct 14 14:02:51 DHCPCBP Norton_AntiVirus[0000]: Scan could
not access path C:\System Volume Information
========================== end of input file =====
Expected Output:
===============
The output file has to be at 14:00:00 hrs is...
================================================
Oct 14 13:46:59:Oct 14 13:47:00 DHCPCBP BROWSER[0000]: The browser was unable to
retrieve a list of servers from the browser master \\SCDEMO8 on the network Device\Nbf_{A3F66BC5-CD4C-466E-9F61-C0A804FF1361}. The data is the error code.
Oct 14 13:47:10:Oct 14 13:48:55 DHCPCBP BROWSER[0000]: The browser service has f
ailed to retrieve the backup list too many times on transport \Device\Nbf_{A3F
66BC5-CD4C-466E-9F61-C0A804FF1361}. The backup browser is stopping.
The output file has to be at 14:15:00 hrs is...
==============================================
Oct 14 14:01:04:Oct 14 14:02:44 DHCPCBP Norton_AntiVirus[0000]: Scan start
ed on selected drives and folders and all extensions.
Oct 14 14:02:14:Oct 14 14:02:51 DHCPCBP Norton_AntiVirus[0000]: Scan could
not access path C:\System Volume Information
For example, let us say if I run the script at 14:00:00 hrs, I should see the data from 13:45 to 14:00 hrs only.
Similarly, If I run the script at 14:15:00 hrs, I want to see the data from 14:00:00 hrs to 14:00:15 hrs and so on.
I was told that awk and sed commands would help in achieving this. Please give me the solution for the above requirement.
Thanks in advance.
Input file:
==================================
Oct 14 13:46:59:Oct 14 13:47:00 DHCPCBP BROWSER[0000]: The browser was unable to
retrieve a list of servers from the browser master \\SCDEMO8 on the network Device\Nbf_{A3F66BC5-CD4C-466E-9F61-C0A804FF1361}. The data is the error code.
Oct 14 13:47:10:Oct 14 13:48:55 DHCPCBP BROWSER[0000]: The browser service has f
ailed to retrieve the backup list too many times on transport \Device\Nbf_{A3F
66BC5-CD4C-466E-9F61-C0A804FF1361}. The backup browser is stopping.
Oct 14 14:01:04:Oct 14 14:02:44 DHCPCBP Norton_AntiVirus[0000]: Scan start
ed on selected drives and folders and all extensions.
Oct 14 14:02:14:Oct 14 14:02:51 DHCPCBP Norton_AntiVirus[0000]: Scan could
not access path C:\System Volume Information
========================== end of input file =====
Expected Output:
===============
The output file has to be at 14:00:00 hrs is...
================================================
Oct 14 13:46:59:Oct 14 13:47:00 DHCPCBP BROWSER[0000]: The browser was unable to
retrieve a list of servers from the browser master \\SCDEMO8 on the network Device\Nbf_{A3F66BC5-CD4C-466E-9F61-C0A804FF1361}. The data is the error code.
Oct 14 13:47:10:Oct 14 13:48:55 DHCPCBP BROWSER[0000]: The browser service has f
ailed to retrieve the backup list too many times on transport \Device\Nbf_{A3F
66BC5-CD4C-466E-9F61-C0A804FF1361}. The backup browser is stopping.
The output file has to be at 14:15:00 hrs is...
==============================================
Oct 14 14:01:04:Oct 14 14:02:44 DHCPCBP Norton_AntiVirus[0000]: Scan start
ed on selected drives and folders and all extensions.
Oct 14 14:02:14:Oct 14 14:02:51 DHCPCBP Norton_AntiVirus[0000]: Scan could
not access path C:\System Volume Information