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


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to capture last 15mins data logged from server.log file?
# 1  
Old 08-27-2015
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

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


Last edited by Don Cragun; 08-27-2015 at 11:44 PM.. Reason: Add CODE and ICODE tags.
# 2  
Old 08-28-2015
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?
This User Gave Thanks to Don Cragun For This Post:
# 3  
Old 08-31-2015
Wrench

solved

Last edited by manohar2013; 09-01-2015 at 02:25 AM..
# 4  
Old 09-07-2015
Hello maniohar2013,

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



Thanks, in advance,
Robin
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Monitoring log for FATAL in last 15mins only

Hi all, I need to develop the following script. Could anyone please provide me some inputs. 1) Monitor the system log file (sys.log) for any lines in the parameter file that will contain all the different phrases of FATAL errors that the process has to scan for in the sys.log. If any FATAL... (7 Replies)
Discussion started by: stunnerz_84
7 Replies

2. Shell Programming and Scripting

How to compare data from 2 zip files and capture the new records from file2 to a new file

I have 2 zip files which have about 20 million records in each file. file 2 will have additional records than file 1. I want to compare the records in both the files and capture the new records from file 2 into another file file3. Please help me with a command/script which provides me the desired... (8 Replies)
Discussion started by: koneru
8 Replies

3. UNIX and Linux Applications

How to log out of the server in such a manner that you are not logged out of PUTTY?

Hi, I am using EXIT command to log out of the server, But this logs me out of the Putty. Is there any way that I can still be present on Putty and just log out of the server. Every time I have to open a new session of PUTTY for a new server (3 Replies)
Discussion started by: himvat
3 Replies

4. Shell Programming and Scripting

Capture all error message in Log file and send the Log file by email

Hi I have a requirement to write a script to capture all errors in a Logfile and send the file in email. If there is any error occurred the subject of email will be ERROR , If there are no error occurred the subject of email will be SUCCESS. So I created a Log file and put the Appropriate... (2 Replies)
Discussion started by: dgmm
2 Replies

5. Shell Programming and Scripting

How to capture output to log file

Hi I have a script that will run multiple unix & sql commands. I want to see the output as well as capture it to a log file for further analysis. Is there an easy way to do that instead of adding "tee -a logfile" on everyline or even on the execute line (i.e. script | tee -s logfile). Thanks (1 Reply)
Discussion started by: nimo
1 Replies

6. Shell Programming and Scripting

Script to capture userids logged on & killing as well

Can someone help me with a script to capture the list of users logged on at a point of time, and if a particular user id say xyz exists, kill that process Id. (2 Replies)
Discussion started by: ggayathri
2 Replies

7. Shell Programming and Scripting

Capture data in a file

How to capture the rows in a file after executing the store procedure using the perl scripts? (0 Replies)
Discussion started by: vinay123
0 Replies

8. UNIX for Dummies Questions & Answers

Howto capture data from rs232port andpull data into oracle database-9i automatically

Hi, i willbe very much grateful to u if u help me out.. if i simply connect pbx machine to printer by serial port RS232 then we find this view: But i want to capture this data into database automatically when the pbx is running.The table in database will contain similar to this view inthe... (1 Reply)
Discussion started by: boss
1 Replies

9. Shell Programming and Scripting

Capture the command run in the log file

Hi , I have seen some log files where they have captured the command that is being executed, comments present in the scripts and the out put of the command as well, through scripts. could any one of you please let me know how do i do that? Thanks in advance. Cheers, Waseem (4 Replies)
Discussion started by: ahmedwaseem2000
4 Replies

10. Shell Programming and Scripting

capture nohup log file

Hi, I am running my script using nohup, but I am not able to capture the log file for that process could naybody please help... Here is what I am doing.... nohup ./script & 1>/home/user1/log.txt but I am not able to capture the log.....Is there anyother way I can capture the log... (2 Replies)
Discussion started by: mgirinath
2 Replies
Login or Register to Ask a Question