Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Inserting Date&Time Stamp In Existing Log File Post 99485 by shephardfamily on Friday 17th of February 2006 03:12:40 PM
Old 02-17-2006
Error Inserting Date&Time Stamp In Existing Log File

I am trying to insert a line with a date stamp in a file that is used to monitor activity in one of our directories. By doing this, I want to grep that file each day and go to the last entry for each time a error occurred and pull all errors generated if any exist. If error exists I want that error to be sent via email to our team. Each time the log is checked for errors I do not want to include the errors that was sent during the last transmission just newly created errors. How can this be done? Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

File date and time stamp

I have to capture the creation date and time stamp for a file. The ls command doesn't list all the required information. I need year, month, day, hour, minute and second. Any ideas... (1 Reply)
Discussion started by: Xenon
1 Replies

2. Shell Programming and Scripting

Extract info from log file and compute using time date stamp

Looking for a shell script or a simple perl script . I am new to scripting and not very good at it . I have 2 directories . One of them holds a text file with list of files in it and the second one is a daily log which shows the file completion time. I need to co-relate both and make a report. ... (0 Replies)
Discussion started by: breez_drew
0 Replies

3. Linux

rename files in a folder with date&time stamp

Hi, I want to rename all the files (more than 100 files) in a fodler to another folder with date&time stamp. foe eg, file1.dat file2.dat file3.dat .. to be renamed as file1100629_16_30_15.txt (yy-mon-dd_hh_mi_ss) file1100629_16_30_16.txt .. so on (2 Replies)
Discussion started by: feroz
2 Replies

4. UNIX for Dummies Questions & Answers

ls -ltr for a future date/time stamp file

Hi When i do ls -ltr <file1> then it shows me the date and time of the file if - for whatever reason file has future date/time stamp then ls -ltr is not showing the time, it just shows only date part ... even if time is ahead by 2 hr than current time. suppose a file was copied from INDIA... (3 Replies)
Discussion started by: reldb
3 Replies

5. Shell Programming and Scripting

Set date and time stamp of one file to another

Hi I use "touch -t xxxxxxxx" command to set date/time stamp of a file. My requirement is to read the date/time stamp of a file and apply it to another file. Is there anyway to do it simple instead of manually taking date/stamp of first file? TIA Prvn (2 Replies)
Discussion started by: prvnrk
2 Replies

6. Shell Programming and Scripting

If(Condition) Rename a file with (Date+Time) Stamp

Hi! Please see our current script: #!/usr/bin/ksh if (egrep "This string is found in the log" /a01/bpm.log) then mailx -s "Error from log" me@email.com, him@email.com </a01/bpm.log fi To the above existing script, we need to add the following change: 1) After finding the string,... (7 Replies)
Discussion started by: atechcorp
7 Replies

7. Shell Programming and Scripting

How to extract latest file by looking at date time stamp from a directory?

hi, i have a Archive directory in which files are archived or stored with date and time stamp to prevent over writing. example: there are 5 files s1.txt s2.txt s3.txt s4.txt s5.txt while moving these files to archive directory, date and time stamp is added. of format `date... (9 Replies)
Discussion started by: Little
9 Replies

8. Shell Programming and Scripting

Shell Script | Parse log file after a given date and time stamp

I am developing one script which will take log file name, output file name, date, hour and minute as an argument and based on these inputs, the script will scan and capture all the error(s) that have been triggered from a given time. Example: script should capture all the error after 13:50 on Jan... (2 Replies)
Discussion started by: ROMA3
2 Replies

9. Shell Programming and Scripting

Change date time stamp of existing file

I have a file hello.txt which was created today (today's date timestamp) I wish to change its date timestamp (access, modified, created) to 1 week old i.e one week from now. uname -a SunOS mymac 5.11 11.2 sun4v sparc sun4v Can you please suggest a easy way to do that ? (12 Replies)
Discussion started by: mohtashims
12 Replies

10. Shell Programming and Scripting

Add current time stamp column in existing csv file

Hi , I want to add a new column 'current_time stamp' in my existing csv file with current time stamp for all the records.I tried something this but this is printing 0 with date & time and printed date one line above header.Please help awk -F "," 'BEGIN{ OFS="," } {$6=system("date... (5 Replies)
Discussion started by: netdbaind
5 Replies
File::Rotate(3pm)					User Contributed Perl Documentation					 File::Rotate(3pm)

NAME
Log::Agent::File::Rotate - a rotating logfile set SYNOPSIS
# # This class is not user-visible. # # It is documented only for programmers wishing to inherit # from it to further extend its behaviour. # require Log::Agent::Driver::File; require Log::Agent::Rotate; require Log::Agent::File::Rotate; my $config = Log::Agent::Rotate->make(...); my $driver = Log::Agent::Driver::File->make(...); my $fh = Log::Agent::File::Rotate->make("file", $config, $driver); DESCRIPTION
This class represents a rotating logfile and is used drivers wishing to rotate their logfiles periodically. From the outside, it exports a single "print" routine, just like "Log::Agent::File::Native". Internally, it uses the parameters given by a "Log::Agent::Rotate" object to transparently close the current logfile and cycle the older logs. Before rotating the current logfile, the string: *** LOGFILE ROTATED ON <local date> is emitted, so that people monitoring the file via "tail -f" know about it and are not surprised by the sudden stop of messages. Its exported interface is: make file, config This is the creation routine. The config object is an instance of "Log::Agent::Rotate". print args Prints args to the file. After having printed the data, monitor the file against the thresholds defined in the configuration, and possibly rotate the logfiles according to the parameters held in the same configuration object. When the "is_alone" flag is not set in the configuration, the logfile is checked everytime a "print" is issued to see if its inode changed. Indeed, when several instances of the same program using rotating logfiles are running, each of them may decide to cycle the logs at some point in time, and therefore our opened handle could point to an already renamed or unlinked file. AUTHORS
Originally written by Raphael Manfredi <Raphael_Manfredi@pobox.com>, currently maintained by Mark Rogaski <mrogaski@pobox.com>. SEE ALSO
Log::Agent::Rotate(3), Log::Agent::Driver::File(3). perl v5.10.0 2002-05-14 File::Rotate(3pm)
All times are GMT -4. The time now is 09:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy