Sponsored Content
Full Discussion: Delete logs every 3 hours
Top Forums UNIX for Dummies Questions & Answers Delete logs every 3 hours Post 302149846 by tungaw2004 on Saturday 8th of December 2007 05:23:59 AM
Old 12-08-2007
Delete logs every 3 hours

Hi,

I want to setup a cronjob that will delete logs every 2 hours. I have script that delete logs per day. but logging is too big and i want to run a conjob that will delete every 2 hours.

this is my current command but it deletes on a per day basis.

find . -name "*.log[0-9]*" -o -name "*.log" -mtime +3 |xargs rm -fR {} \;
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

delete files that are over 2 hours old

guys, I have a need for a script that will delete all files in a given directory that are over 2 hours old. I will set this up to run in cron. I'm having a little trouble coming up with the syntax that will identify these files. Is there a variation of the ls command that I can use to identify... (3 Replies)
Discussion started by: hedrict
3 Replies

2. Shell Programming and Scripting

I need to delete the content out of a number of logs

I'm just starting out in scripting (taking online classes) but I need to know how to clean out (delete) the content of a number of logs. All of the files end in 'trc'. Does anyone have a script or command (SED or AWK) I can use? Julie (4 Replies)
Discussion started by: Jbolin01
4 Replies

3. Shell Programming and Scripting

Delete old logs

Hello All, We have a directory where we have old archived logs. They are numbered <logfile>.log.1 till <logfile>.log.100 or more. I just want to keep 10 log files and delete others through the script. Please advise. Thanks, Chiru (4 Replies)
Discussion started by: chiru_h
4 Replies

4. UNIX for Dummies Questions & Answers

Delete last 10 days logs

Hi Can u please tell me how to delete last 10 days logs .. (9 Replies)
Discussion started by: pb18798
9 Replies

5. Shell Programming and Scripting

Retrieve logs for last 4 hours

Our log file looks like this: 2010-11-18 00:57:01,698 ERROR Shipment Error Log:Error Details - Account Id:3962, PO:2710015, Line:2, File:221112901, Version:V1, Desc:Order cannot not be shipped as there are no line items in New state 2010-11-18 14:59:39,960 ERROR... (11 Replies)
Discussion started by: Deepthz
11 Replies

6. Shell Programming and Scripting

Retrieve logs for previous 4 hours

Hi, I am in the process of configuring a script, and i intend it to retrieve logs for previous four hours, and then scan for predefined errors. I am kind of stuck on the log retrieval part where the script will run early morning like 1 AM or 2 AM, the command as posted below will give me... (4 Replies)
Discussion started by: john_prince
4 Replies

7. Shell Programming and Scripting

Command to clear logs for every 6 hours in solaris

Hi Folks, I need to remove log files for six hours on Solaris. before i used to do for every 24 hours below is the code for 1 day older log files, now i tried using -mmin +360 but it says command not found. Can someone please help me out!!! part of the code: LOG_FILE=`find /home/Logdir... (1 Reply)
Discussion started by: Sendhil.Kumaran
1 Replies

8. Shell Programming and Scripting

To delete logs older than 30 days

I want to write a shell script that deletes all log files in a directory that are older than 30 days except for 3 files: I am using the following command: find /tmp/logs -name "*.log" -mtime +30 -exec rm -f {} \;But this command deletes all the log files. How can i modify this script that... (5 Replies)
Discussion started by: mmunir
5 Replies

9. Shell Programming and Scripting

Delete logs older than 60 days

i am using HP-UX OS...... delete logs older than 60 days find -mtime +60 | grep -i '.*log' | xargs rm -mtime is nt available in HP-UX, pls tell me other option ? (2 Replies)
Discussion started by: only4satish
2 Replies

10. Shell Programming and Scripting

Script to compress and delete the older logs

Hello Guys, Can you please help me with a script which zips the older log files(1-2 weeks) and delete them? I want to run the script manually instead of setting it up in a cron job. Appreciate your help. Regards, Kris (6 Replies)
Discussion started by: kriss.gv
6 Replies
EKGLOGS(1)						      General Commands Manual							EKGLOGS(1)

NAME
ekglogs - a logs lister for EKG SYNTAX
ekglogs [ options ] < ~/.gg/history DESCRIPTION
ekglogs reads ekg logs on standard input and prints them out nicely formatted on standard output. OPTIONS
-t don't display time at all -d don't display day changes -x always print nicknames -v never display nicknames (by default: print nicknames unless either `u' or `n' was specified) -r display incoming messages' receipt time -R like -r and align outgoing messages -s display seconds -S display receipt time seconds -C display a colon between hours and minutes -b do not display malformed lines (they start with !!!) -a do not display status changes -c use colourful display -h display help message -u UIN display only messages from/to UIN -n NICK display only messages from/to NICK Options don't need to be preceded with `-', and may be concatenated. Option `u' or `n' should be specified as last one. You should not specify both `u' and `n'. AUTHOR
Robert Goliasz <rgoliasz@poczta.onet.pl> SEE ALSO
ekg(1) 7 September 2003 EKGLOGS(1)
All times are GMT -4. The time now is 10:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy