LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 05-01-2013, 07:05 AM   #1
Linux_CTL_2013
LQ Newbie
 
Registered: Jan 2013
Location: Hyderabad, India
Distribution: RHEL5
Posts: 5

Rep: Reputation: Disabled
Log Rotation with Date & Timstamp for Rotated File




Hello ALL,

First thing am sorry if am Duplicating this thread with an existing thread.


I have set Log Rotation for my tomcat.out files to be rotated, please find the script set in logrotate.d folder.

/var/log/myapplication.out{
copytruncate
daily
rotate 20
nocompress
missingok
size 500M
}


The Script works fine, however when it rotates it makes filename.out.1 and so on. Is there a way i can change that Rotated filename to filename.date/timestamp?

Please Advice.

Thanks in Advance!
 
Old 05-01-2013, 07:38 AM   #2
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,269

Rep: Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028
See dateext, dateformat options http://linux.die.net/man/8/logrotate
 
Old 05-01-2013, 09:53 AM   #3
Linux_CTL_2013
LQ Newbie
 
Registered: Jan 2013
Location: Hyderabad, India
Distribution: RHEL5
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by chrism01 View Post
See dateext, dateformat options http://linux.die.net/man/8/logrotate
Hello Chris,


Thanks for the reply.


The man page i was referring to was a old kne, it didnt have the options.

Thanks again!
 
Old 05-02-2013, 12:44 AM   #4
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,269

Rep: Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028
Glad to help
Actually, the 'safest' (in terms of versions) is usually to use the man pages on your system; they should be correct for that(!) system, at least
 
  


Reply

Tags
logfile, rotation


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Logrotate - email log about to be rotated killminus9 Linux - Server 3 05-24-2012 02:24 AM
[SOLVED] Log file rotation problem mgai7755 Linux - Newbie 10 04-21-2011 03:31 AM
Log file rotation problem aliweb Linux - Newbie 10 02-02-2011 07:01 AM
log files not being rotated sang_froid Linux - Server 2 12-11-2009 09:11 AM
archiving rotated log files tjainsworth Linux - Security 4 07-12-2006 01:00 PM


All times are GMT -5. The time now is 12:57 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration